Giter Club home page Giter Club logo

babel-plugin-transform-postcss's People

Contributors

adierkens avatar chrisngobanh avatar greenkeeper[bot] avatar igor-ribeiro avatar nescalante avatar wbyoung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

babel-plugin-transform-postcss's Issues

Transform leaves process running causing CI to fail

When the build process (babel) quits and the transform was used it leaves a child process running which causes CI build to hang and eventually fail.

Code to reproduce:

const babel = require("babel-core");

const babelOpts = {
  plugins: [
    ['transform-postcss', {
      config: 'path/to/postcss.config.js'
    }]
  ]
};

const source = 'const s = require("./path/to/postcss/file.css");';

const res = babel.transform(source, babelOpts);
console.log(res.code);

postcss.config.js:

module.exports = ctx => ({
  plugins: []
});

CSS file:

.link {
  color: red;
}

The transpiled code is correct the only problem is orphaned child process.

After looking for details I found in MacOS's Activity Monitor that this process is using /tmp/bptp-<projectname>.sock file.

Improve speed for large projects

Performance may be impacted by PostCSS compilation, the client-server setup (including launching a node process for the client on each compiled file). The following are ideas on how to make things faster.

Synchronous Promise Resolution

The client-server model could be removed entirely if the PostCSS compilation was able to be done synchronously (i.e., resolve a promise synchronously).

In order to accomplish this, a bit of native code would need to be written to run the event loop. For reference, node's event loop is basically just a uv_run(env.event_loop(), UV_RUN_ONCE);. A small bit of native code (similar to deasync… or even use deasync) and a bit of JS code to invoke this could be sufficient. The JS would be something like:

let error, result;
let done = false;
const runner = postcss(plugins);

runner.process(source, opts).then(
  (res) => { done = true; result = res; },
  (err) => { done = true; error = err; }
);

while (!done) {
  binding.runLoop();
}

Besides the fact that a bit of native code would be introduced (making things a little harder to maintain), this actually simplifies the code significantly.

Caching PostCSS Compilation

Since the server remains active while the main process continues, it would be beneficial for various situations to cache the results of a compile. It's important to realize that the cache would likely be in memory, so it would only apply when babel & the plugin remain active in memory while the CSS file is encountered multiple times. This would happen for:

  1. Watched builds
  2. Builds that include the same CSS file from multiple different JS files

Re-write the postcss-client in C++ using node-gyp

The client that we launch is written in Node and is as minimal as possible, but launching a minimal Node process is still nearly 30x slower (on my machine) than launching a native executable.

Creating a binding.gyp with the type set to executable seems to work:

{
  "targets": [
    {
      "target_name": "postcss-client",
      "type": "executable",
      "sources": [ "src/postcss-client.cc" ]
    }
  ]
}
node-gyp rebuild

There's overhead in the client-server communication, too, so this may or may not provide significant performance gains. The best way to find out, though, may be to try it and see. The synchronous promise resolution seems to be a much easier option to avoid this, though.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of nyc is breaking the build 🚨

Version 10.1.0 of nyc just got published.

Branch Build failing 🚨
Dependency nyc
Current Version 10.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As nyc is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 14 commits .

  • 8f7af3a chore(release): 10.1.0
  • 8c58d68 fix: address edge-cases related to --all when instrumentation is disabled (#482)
  • 8b58c05 feat: allow eager instantiation of instrumenter (#490)
  • d8d2de0 feat: upgrade to istanbul-lib-instrument with support for 'const foo = function () {}' name preservation. upgrade to istanbul-lib-hook with fix for ts-node. (#494)
  • 7708235 chore: add test and docs for high and low watermarks (#493)
  • 0a1d72a feat: reporting watermarks can now be set in nyc config stanza (#469)
  • 1022b16 fix: pass configuration options to --check-coverage (#483)
  • 7b4c090 chore(package): update tap to version 9.0.3 (#488)
  • 093963b chore(release): 10.0.2
  • e01ec8c fix: upgrade to newer istanbul-lib-instrument, with fixes for inferred function names (#479)
  • 2e39e00 chore(release): 10.0.1
  • e0ef1d5 fix: upgrade spawn-wrap and istanbul-lib-instrument (#477)
  • 8603aa9 chore(package): update is-windows to version 1.0.0 (#466)
  • 64ae4f3 chore(package): update standard-version to version 4.0.0 (#461)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of eslint is breaking the build 🚨

Version 4.14.0 of eslint was just published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.13.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v4.14.0
  • be2f57e Update: support separate requires in one-var. (fixes #6175) (#9441) (薛定谔的猫)
  • 370d614 Docs: Fix typos (#9751) (Jed Fox)
  • 8196c45 Chore: Reorganize CLI options and associated docs (#9758) (Kevin Partington)
  • 75c7419 Update: Logical-and is counted in complexity rule (fixes #8535) (#9754) (Kevin Partington)
  • eb4b1e0 Docs: reintroduce misspelling in valid-typeof example (#9753) (Teddy Katz)
  • ae51eb2 New: Add allowImplicit option to array-callback-return (fixes #8539) (#9344) (James C. Davis)
  • e9d5dfd Docs: improve no-extra-parens formatting (#9747) (Rich Trott)
  • 37d066c Chore: Add unit tests for overrides glob matching. (#9744) (Robert Jackson)
  • 805a94e Chore: Fix typo in CLIEngine test name (#9741) (@scriptdaemon)
  • 1c2aafd Update: Improve parser integrations (fixes #8392) (#8755) (Toru Nagashima)
  • 4ddc131 Upgrade: debug@^3.1.0 (#9731) (Kevin Partington)
  • f252c19 Docs: Make the lint message source property a little more subtle (#9735) (Jed Fox)
  • 5a5c23c Docs: fix the link to contributing page (#9727) (Victor Hom)
  • f44ce11 Docs: change beginner to good first issue label text (#9726) (Victor Hom)
  • 14baa2e Chore: improve arrow-body-style error message (refs #5498) (#9718) (Teddy Katz)
  • f819920 Docs: fix typos (#9723) (Thomas Broadley)
  • 43d4ba8 Fix: false positive on rulelines-between-class-members (fixes #9665) (#9680) (sakabar)
Commits

The new version differs by 19 commits.

  • 8d166b4 4.14.0
  • 5a29612 Build: changelog update for 4.14.0
  • be2f57e Update: support separate requires in one-var. (fixes #6175) (#9441)
  • 370d614 Docs: Fix typos (#9751)
  • 8196c45 Chore: Reorganize CLI options and associated docs (#9758)
  • 75c7419 Update: Logical-and is counted in complexity rule (fixes #8535) (#9754)
  • eb4b1e0 Docs: reintroduce misspelling in valid-typeof example (#9753)
  • ae51eb2 New: Add allowImplicit option to array-callback-return (fixes #8539) (#9344)
  • e9d5dfd Docs: improve no-extra-parens formatting (#9747)
  • 37d066c Chore: Add unit tests for overrides glob matching. (#9744)
  • 805a94e Chore: Fix typo in CLIEngine test name (#9741)
  • 1c2aafd Update: Improve parser integrations (fixes #8392) (#8755)
  • 4ddc131 Upgrade: debug@^3.1.0 (#9731)
  • f252c19 Docs: Make the lint message source property a little more subtle (#9735)
  • 5a5c23c Docs: fix the link to contributing page (#9727)

There are 19 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Hanging Node process with Express

We generate Webpack builds by hitting one Express route, which triggers a CLI command to build with Webpack. That way, this plugin hangs the process and the route never returns.

I'm pretty sure the problem is with sockets, cause killing the .sock process created by the plugin makes the route respond.

It only happens when we use the route, running the build command on the terminal works. Not using the plugin also works.

Specify PostCSS config file

It appears that the plugin searches for a PostCSS config file to load in the same directory that the imported CSS file resides, or in the root directory of the project.

There should be an option in the plugin to specify where to find the project's PostCSS config file.

An in-range update of mocha is breaking the build 🚨

Version 3.4.0 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v3.4.0

Mocha is now moving to a quicker release schedule: when non-breaking changes are merged, a release should happen that week.

This week's highlights:

  • allowUncaught added to commandline as --allow-uncaught (and bugfixed)
  • warning-related Node flags

🎉 Enhancements

🐛 Fixes

🔩 Other

Commits

The new version differs by 9 commits0.

  • 7554b31 Add Changelog for v3.4.0
  • 9f7f7ed Add --trace-warnings flag
  • 92561c8 Add --no-warnings flag
  • ceee976 lint test/integration/fixtures/simple-reporter.js
  • dcfc094 Revert "use semistandard directly"
  • 93392dd no special case for macOS running Karma locally
  • 4d1d91d --allow-uncaught cli option
  • fb1e083 fix allowUncaught in browser
  • 4ed3fc5 Add license report and scan status

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

ENOENT/EACCESS errors on Windows 10

Hello,

I get the following error when I try to build my files:

> babel src --ignore  __tests__,__mocks__ --out-dir lib

Error: ENOENT: no such file or directory, mkdir 'C:\tmp\bptp-cgitfrontendcomponents'
    at Object.fs.mkdirSync (fs.js:890:18)
    at main (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:59:18)
    at __dirname (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:166:13)
    at Object.<anonymous> (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:170:5)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)

So I added manually tmp dir in C: but now I get:

Error: listen EACCES \tmp\bptp-cgitfrontendcomponents.sock
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server.setupListenHandle [as _listen2] (net.js:1298:19)
    at listenInCluster (net.js:1363:12)
    at Server.listen (net.js:1474:5)
    at Promise (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:154:12)
    at Promise (<anonymous>)
    at main (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:134:9)
    at __dirname (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:166:13)
    at Object.<anonymous> (C:\GIT\frontend-components\node_modules\babel-plugin-transform-postcss\dist\postcss-server.js:170:5)

Tried also running cmd with admin rights - still same error. Did anyone have similar issue?

Using:
node v8.1.3
npm v5.3.0
bptp v0.2.1

.babelrc

{
  "presets": [
    ["es2015", {"modules": false}],
    "react"
  ],
  "plugins": [
    "transform-class-properties",
    "transform-object-rest-spread",
    "transform-postcss"
  ]
}

An in-range update of eslint is breaking the build 🚨

Version 3.16.0 of eslint just got published.

Branch Build failing 🚨
Dependency eslint
Current Version 3.15.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v3.16.0
  • d89d0b4 Update: fix quotes false negative for string literals as template tags (#8107) (Teddy Katz)
  • 21be366 Chore: Ensuring eslint:recommended rules are sorted. (#8106) (Kevin Partington)
  • 360dbe4 Update: Improve error message when extend config missing (fixes #6115) (#8100) (alberto)
  • f62a724 Chore: use updated token iterator methods (#8103) (Kai Cataldo)
  • daf6f26 Fix: check output in RuleTester when errors is a number (fixes #7640) (#8097) (alberto)
  • cfb65c5 Update: make no-lone-blocks report blocks in switch cases (fixes #8047) (#8062) (Teddy Katz)
  • 290fb1f Update: Add includeComments to getTokenByRangeStart (fixes #8068) (#8069) (Kai Cataldo)
  • ff066dc Chore: Incorrect source code test text (#8096) (Jack Ford)
  • 14d146d Docs: Clarify --ext only works with directories (fixes #7939) (#8095) (alberto)
  • 013a454 Docs: Add TSC meeting quorum requirement (#8086) (Kevin Partington)
  • 7516303 Fix: sourceCode.getTokenAfter shouldn't skip tokens after comments (#8055) (Toru Nagashima)
  • c53e034 Fix: unicode-bom fixer insert BOM in appropriate location (fixes #8083) (#8084) (pantosha)
  • 55ac302 Chore: fix the timing to define rules for tests (#8082) (Toru Nagashima)
  • c7e64f3 Upgrade: mock-fs (#8070) (Toru Nagashima)
  • acc3301 Update: handle uncommon linebreaks consistently in rules (fixes #7949) (#8049) (Teddy Katz)
  • 591b74a Chore: enable operator-linebreak on ESLint codebase (#8064) (Teddy Katz)
  • 6445d2a Docs: Add documentation for /* exported */ (fixes #7998) (#8065) (Lee Yi Min)
  • fcc38db Chore: simplify and improve performance for autofix (#8035) (Toru Nagashima)
  • b04fde7 Chore: improve performance of SourceCode constructor (#8054) (Teddy Katz)
  • 90fd555 Update: improve null detection in eqeqeq for ES6 regexes (fixes #8020) (#8042) (Teddy Katz)
  • 16248e2 Fix: no-extra-boolean-cast incorrect Boolean() autofixing (fixes #7977) (#8037) (Jonathan Wilsson)
  • 834f45d Update: rewrite TokenStore (fixes #7810) (#7936) (Toru Nagashima)
  • 329dcdc Chore: unify checks for statement list parents (#8048) (Teddy Katz)
  • c596690 Docs: Clarify generator-star-spacing config example (fixes #8027) (#8034) (Hòa Trần)
  • a11d4a6 Docs: fix a typo in shareable configs documentation (#8036) (Dan Homola)
  • 1e3d4c6 Update: add fixer for no-unused-labels (#7841) (Teddy Katz)
  • f47fb98 Update: ensure semi-spacing checks import/export declarations (#8033) (Teddy Katz)
  • e228d56 Update: no-undefined handles properties/classes/modules (fixes #7964) (#7966) (Kevin Partington)
  • 7bc92d9 Chore: fix invalid test cases (#8030) (Toru Nagashima)
Commits

The new version differs by 31 commits .

  • 3c26a59 3.16.0
  • 5bdb960 Build: package.json and changelog update for 3.16.0
  • d89d0b4 Update: fix quotes false negative for string literals as template tags (#8107)
  • 21be366 Chore: Ensuring eslint:recommended rules are sorted. (#8106)
  • 360dbe4 Update: Improve error message when extend config missing (fixes #6115) (#8100)
  • f62a724 Chore: use updated token iterator methods (#8103)
  • daf6f26 Fix: check output in RuleTester when errors is a number (fixes #7640) (#8097)
  • cfb65c5 Update: make no-lone-blocks report blocks in switch cases (fixes #8047) (#8062)
  • 290fb1f Update: Add includeComments to getTokenByRangeStart (fixes #8068) (#8069)
  • ff066dc Chore: Incorrect source code test text (#8096)
  • 14d146d Docs: Clarify --ext only works with directories (fixes #7939) (#8095)
  • 013a454 Docs: Add TSC meeting quorum requirement (#8086)
  • 7516303 Fix: sourceCode.getTokenAfter shouldn't skip tokens after comments (#8055)
  • c53e034 Fix: unicode-bom fixer insert BOM in appropriate location (fixes #8083) (#8084)
  • 55ac302 Chore: fix the timing to define rules for tests (#8082)

There are 31 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of postcss is breaking the build 🚨

Version 6.0.12 of postcss just got published.

Branch Build failing 🚨
Dependency postcss
Current Version 6.0.11
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As postcss is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • coverage/coveralls First build on greenkeeper/postcss-6.0.12 at 100.0% Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes 6.0.12
  • Don’t copy * hack to declaration indent.
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Module resolver

Hello!

I've been trying to use babel-plugin-transform-postcss but I keep having ENOENT due to the path used in the project. I didn't want to end up with ../../grid.css so I added in my webpack configuration my src folder in the resolve module array.

resolve: {
    modules: [
      'node_modules',
      'src'
    ],
    ...
    }
  },

How can I do the same here?

Thanks!

An in-range update of babel-eslint is breaking the build 🚨

Version 8.2.5 of babel-eslint was just published.

Branch Build failing 🚨
Dependency [babel-eslint](https://github.com/babel/babel-eslint)
Current Version 8.2.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

babel-eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
  • coverage/coveralls First build on greenkeeper/babel-eslint-8.2.5 at 100.0% Details

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Disable caching

There should be an option to disable caching, and perhaps have it disabled by default. I was really confused about the behavior of the plugin until I realized that there was caching involved.

An in-range update of postcss is breaking the build 🚨

Version 5.2.15 of postcss just got published.

Branch Build failing 🚨
Dependency postcss
Current Version 5.2.14
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As postcss is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes 5.2.15
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

resolve wrong path for external modules

Code of my component

myproject/components/super-component/index.jsx

import 'external-module/styles.css';
import styles from './my-local-styles.css';

// ...

Babel config

.babelrc

{
    "presets": ["es2017-node7", "react"],
    "plugins": ["transform-postcss"],
    "ignore": ["node_modules"]
}

And I get an error:

babel-plugin-transform-postcss: Error: ENOENT: no such file or directory, open '/Users/frux/myproject/components/super-component/external-module/external-module/styles.css'
    at Object.fs.openSync (fs.js:583:18)
    at Object.fs.readFileSync (fs.js:490:33)
    at Socket.connection.on (/Users/frux/myproject/node_modules/babel-plugin-transform-postcss/dist/postcss-server.js:81:22)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Why does plugin try to find external styles at relative path?

Unexpected token function for `async`

When I try using the transform I get the following when running with Node 6:

/node_modules/babel-plugin-transform-postcss/dist/postcss-server.js:56
const main = async function main(socketPath, tmpPath) {
                   ^^^^^^^^
SyntaxError: Unexpected token function

I don't have any issues when running with Node 7, but our current architecture doesn't quite support 7 yet. Any thoughts on how I can get around this?

My .babelrc:

{
  "plugins": [
    ["babel-plugin-transform-builtin-extend", {
        "globals": ["Error"]
    }],
    ["transform-runtime", {
      "polyfill": false
    }],
    "transform-decorators-legacy",
    "transform-export-extensions",
    "transform-object-rest-spread",
    "lodash"
  ],
  "presets": [
    "es2015",
    ["env", {
      "targets": {
        "node": "current"
      }
    }]
  ]
}

Support SugarSS?

Hi, I'd like to use this plugin but it doesn't seem to support the .sss extension (SugarSS).

Any chance to see this supported? I'd be happy to create a PR to add support if you like the idea.

How to make CSS modules random hashmaps match?

I think I'm missing something on how we are supposed to use this plugin and CSS Modules.

If I make this plugin generate CSS modules, or better, transform my classes (.foo) into random names (.foo_xyz123).

How can I then process my PostCSS to compile it into valid CSS having the classes transformed the same way? (.foo to .foo_xyz123)

Wouldn't be easier to support an extract option like babel-plugin-css-modules-transform?

Can't make it work

Hello,

Thanks for this plugin! I'm sorry I must be confused but I just can't make it work. Between the magic cache and the socket servers that I can't stop on exit, it's really hard tu use.. But that's not the (main) issue here.

I'd like to understand exactly how to use postCSS plugins. I created a postcss.config.js that I used from a server.js file

...
require('babel-register')({
  "plugins": [
    [
      "transform-postcss", {
        "config": 'config/postcss.config.js',
      }
    ]
  ]
});
...
var paths = require('./paths');

var postcssModules = require('postcss-modules')
var cssnext = require('postcss-cssnext');
var smartImport = require("postcss-smart-import");
var postcssImport = require('postcss-import');
var postcssSimpleVars = require('postcss-simple-vars');
var postcssMixins = require('postcss-mixins');
var postcssExtend = require('postcss-extend');
var postcssNested = require('postcss-nested');
var postcssFor = require('postcss-for');
var postcssMath = require('postcss-math');
var postcssTextTransform = require('postcss-text-transform');
var postcssConditionals = require('postcss-conditionals');
var cssVars = require(paths.appSrc + '/base/vars/index.js');

module.exports = (ctx) => ({
    plugins: [
      postcssModules({
        generateScopedName: '[name]__[local]___[hash:base64:5]',
        getJSON: ctx.extractModules || (() => {})
      }),
      postcssImport({
        path: paths.appSrc + '/'
      }),
      postcssFor(),
      postcssMixins(),
      postcssTextTransform(),
      postcssConditionals(),
      postcssSimpleVars({
        variables: () => cssVars,
        unknown: (node, name, result) => node.warn(result, 'Unknown CSS variable ', name),
      }),
      postcssExtend(),
      postcssNested(),
      postcssMath(),
      cssnext({ // Allow future CSS features to be used, also auto-prefixes the CSS...
        browsers: ['last 2 versions', 'iOS >= 8', 'not IE <= 10'], // ...based on this browser list
      })
    ]
  });

After taking a while to compile, I don't really have any change.. Is this the correct way to use it?

Thanks!

Keeping import declaration

Hi. In another similar package called babel-plugin-css-modules-transform, one day, I've added the feature keepImport, which allows do not remove the import declaration, after all transformations. It was a good time, until I found your package more useful. But your package also has no opportunity to keep import declaration. Therefor, I'm going to perform that for you.

Here's description of the coming feature. I hope you will found it useful.

Keeping import

By default, original import declaration in javascript code will be replaced with an object with styles. But you may keep import declarations by turning the option keepImport to true.

{
  "plugins": [
    ["transform-postcss", {
      "config": "configuration/postcss.config.js",
      "extensions": [".scss"],
      "keepImport": true
    }]
  ]
}

In this case, you will still get the required objects with styles, but import declarations (or require expressions) will be kept above without any assignment expression.

For example, this code:

import styles from './styles';
.example { color: cyan; }

Will be transformed to:

import './styles';
var styles = {"example":"_example_amfqe_1"};

An in-range update of babel-preset-env is breaking the build 🚨

Version 1.1.9 of babel-preset-env just got published.

Branch Build failing 🚨
Dependency babel-preset-env
Current Version 1.1.8
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-preset-env is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 20 commits .

  • 846b7a2 1.1.9
  • 48049aa update compat (#169)
  • d1f301e Add tests for debug output (#156)
  • 9667dae Fixes #143. Log correct targets. (#155)
  • 48bde3b Fix compat-table link in contributing.md
  • a59cf5b Update yarn lockfile (#152)
  • 27f33a1 Update README examples to fix website [skip ci] (#151)
  • 55aa7ff Use external Electron to Chromium library (#144)
  • 96efb98 Merge pull request #146 from babel/typos
  • 5fd3406 Fix few typos
  • 7acd181 Merge pull request #125 from babel/feature/extract-option-validation
  • b8c768f Extract option normalization into independant file
  • d726a5b Update yarnfile
  • 785d8ea devDeps: eslint-config-babel v5.0.0 (#139)
  • fcf220c Merge pull request #138 from yavorsky/debug-example

There are 20 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-flowtype is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 2.46.1 of eslint-plugin-flowtype was just published.

Branch Build failing 🚨
Dependency eslint-plugin-flowtype
Current Version 2.46.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-flowtype is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
  • coverage/coveralls First build on greenkeeper/eslint-plugin-flowtype-2.46.1 at 100.0% Details

Release Notes v2.46.1

<a name"2.46.1">

2.46.1 (2018-02-22)

Bug Fixes

  • (type-import-style) Support import aliases when fixing (#321) (d7ccd0dd)
Commits

The new version differs by 1 commits.

  • d7ccd0d fix: (type-import-style) Support import aliases when fixing (#321)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Nothing transformed when `modules: false` is used.

The current babel visitor is only looking for require('foo.css') statements, which misses the import statements when modules are disabled.

Should be simple enough to add in a ImportDeclaration visitor to handle all imports and not just the ones transpiled to require statements.

How to install latest?

Maybe I'm just too dumb but I'm having problems to install this package.
Here's what happens:

  1. Npm says the newest version is 0.3.0 (published a year ago)
  2. When referencing the master branch I'm basically lacking ALL src files and just get an index.js, requireing the (also not available) dist folder.

Am I missing something? Would really like to have the extensions fix.

An in-range update of mocha is breaking the build 🚨

Version 5.1.1 of mocha was just published.

Branch Build failing 🚨
Dependency mocha
Current Version 5.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
  • coverage/coveralls First build on greenkeeper/mocha-5.1.1 at 100.0% Details

Release Notes v5.1.1

5.1.1 / 2018-04-18

🐛 Fixes

Commits

The new version differs by 6 commits.

  • e0bc1c1 Release v5.1.1
  • eac31fe update package-lock.json [ci skip]
  • fde558d update CHANGELOG.md for v5.1.1 [ci skip]
  • a5fd5e6 Revert "remove default js in "--watch-extensions" option; closes #3275"
  • 7057638 update outdated info in docs/README.md [ci skip]
  • 5212718 fix ESLint problems and consolidate configuration

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.