-
Notifications
You must be signed in to change notification settings - Fork 47
Add user configurable PostCSS plugins. #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There's still work that needs to be done. Specifically around configuring PostCSS plugins (eg. autoprefixer). As certain PostCSS plugins are in of themselves configurable, how do we manage this? A good example of this comes from: https://github.com/code42day/postcss-cli#examples
|
@@ -13,6 +14,9 @@ module.exports = function (browserify, options) { | |||
throw new Error('css-modulesify needs the --output / -o option (path to output css file)'); | |||
} | |||
|
|||
// PostCSS plugins passed to FileSystemLoader | |||
var plugins = options.plugins || options.p || Core.defaultPlugins; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshgillies do you know if plugins
works as strings or does css-modules-loader-core
expect an array of objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it expects an array! Good catch. 👍
@joshwnj OK should be requiring plugins via user input now. Which I guess handles this CLI use case:
However, assuming the following use case: var browserify = require('browserify')
var b = browserify('./index.js')
b.plugin('css-modulesify', {
output: './bundle.css',
plugins: [
require('postcss-color-function'),
require('postcss-modules-extract-imports'),
require('postcss-modules-scope'),
require('autoprefixer')
]
}); Maybe we should also be checking to see whether the plugin has already been What do you think? |
The above concerns should now be addressed. An updated example would look something like this:
Thoughts? |
Looking great @joshgillies , this will be a huge improvement! Have you given it a trial run in the https://github.com/css-modules/browserify-demo yet? Will be good to demonstrate this new behaviour somewhere at any rate |
I've been testing the demo over here, https://github.com/joshgillies/browserify-demo/tree/plugins. For the most part it works, however |
This error is thrown when `node` doesn't have the property of `_autoprefixerDisabled`: [TypeError: Cannot read property '_autoprefixerDisabled' of undefined] ref: css-modules/css-modulesify#13 & css-modules/css-modulesify#13 (comment)
This error is thrown when `node` doesn't have the property of `_autoprefixerDisabled`: [TypeError: Cannot read property '_autoprefixerDisabled' of undefined] ref: css-modules/css-modulesify#13 & css-modules/css-modulesify#13 (comment)
Ok, now that ai/autoprefixer-core#57 has been merged, we should be in a good position to roll this out. I've just published some documentation around how PostCSS plugins can be used and configured. @joshwnj would you care to take a look? As an aside I'd also like to squash some of these commits before we merge. 😄 |
@joshgillies looks great, merge when ready :) |
Add user configurable PostCSS plugins.
## autoprefixer 5.1.0 → 6.0.3 - Use postcss-loader in webpack example - README: change of wording for disabling section - Merge pull request #330 from adam-lynch/patch-1 README: change of wording for disabling section - Fix 80 columns line - Add old flexbox question to FAQ - Clean up flexbox in FAQ - Updating Firefox ESR version - Merge pull request #338 from rfsbsb/patch-1 Updating Firefox ESR version - Add postcss-epub to README.md - Clean up PostCSS mention - Fix line breaks in README.md - Add famous users to README.md - Remove broken Prepros image - Add Jekyll usage to Readme - Merge pull request #353 from aderyabin/readme_jekyll Add Jekyll usage to Readme - Typo - Add html-autoprefixer to README.md - Use SVG Travis CI badge - Updated hack count - Merge pull request #363 from trevorah/patch-1 Updated hack count - Removed weird comma - Merge pull request #364 from trevorah/patch-2 Removed weird comma - Add Evil Martians badge - Remove outdated browser query - Typo - Add map support to Compass config - Clean up Compass config example - Add instructions on using with less - Merge pull request #369 from lukeapage/master Add instructions on using with less - Typo - Add support list link to FAQ - Move big companies to top - Shorter big users - Add Taobao to main users - Use Autoprefixer Core 5.0 from master - Add CSS Grace plugin to README.md - Fix Compass map support - Mention that Compass config.rb hack is a hack - Add notice about appearance - Add remove option to README.md - Safer string split in flex hack - Update Can I Use package - Release 5.1.1 version - Add @-ms-keyframes to common mistakes list because of Font Awesome - Add @-ms-keyframes to common mistakes list - Update dependencies - Release 5.1.2 version - Add IE support for crisp-edges - Update Can I Use data - Release 5.1.3 version - Add node.js 0.12 to Travis CI - Add iojs to Travis CI - Add -webkit- prefix support for Opera Mobile too - Update dependencies - Release 5.1.4 version - Take prefix exception from Can I Use - Add transition to CSS Masks - Release 5.1.5 versioin - Update polyfill section in FAQ - Fix holy 80 columns line - Fixed a typo in README.md - Merge pull request #411 from bernig/patch-1 Fixed a typo in README.md - Fix typo and grammar in readme - Merge pull request #412 from arhoads/patch-1 Fix typo and grammar in readme - Add ::placeholder-shown support - Merge pull request #32 from iamvdo/master Add ::placeholder-shown support - Update npm dependencies - Release 5.1.6 version - Fix: :placeholder-shown is a pseudo-class, not pseudo-element - Merge pull request #34 from iamvdo/master Fix: :placeholder-shown is a pseudo-class, not pseudo-element - Update npm dependencies - Fix versioins header - Release 5.1.7 version - Updated readme section about `appearance` to be more readable - Merge pull request #414 from farcaller/patch-1 Updated readme section about `appearance` to be more readable - Removed -moz- prefix in README example - Merge pull request #416 from AllThingsSmitty/master Removed -moz- prefix in README example - Improve the README text quality Stylistic edits, fixing some typos, making some sentences a little cleaner. - Merge pull request #418 from aruseni/patch-1 Improve the README text quality - Clean up docs - Fix word wraps in docs - Update npm dependencies - Typo in README.md - Add mask properties to gradients - Add old webkits to mask background too - Fix old webkit gradient ignoring - Release 5.1.8 version - Compress logo by SVGO - Update npm dependencies - DynJS compatibility DynJS (dynjs.org) is a JVM-based ECMAscript engine, which currently fails to run this module as it expects array sort functions to always return integer values, not floats. This minor change will still work with other more lenient engines but allows autoprefixer to run in DynJS, which in turn allows this module to work in Nodyn (http://nodyn.io/). - Merge pull request #41 from halfninja/patch-1 DynJS compatibility - Add webkit-keyframes question to FAQ - Update npm dependencies - Release 5.1.9 version - Update README.md "throw" reminds me of errors. I think "through" is meant here. - Merge pull request #42 from martco/patch-1 Update README.md - Do not generate -webkit-image-rendering - Update npm dependencies - Release 5.1.10 version - Update num2fraction to 1.1.0 Use more precise (not fixed) precision factor for the calculation yisibl/num2fraction#1 - Release 5.1.11 version - Fix links - Update postcss plugins link - Merge pull request #451 from stevemao/patch-1 Update postcss plugins link - Remove appearance from FAQ - Remove display: box from FAQ - Remove gradients from FAQ - Fix FAQ order - Remove outdated Autoprefixer plugins - Move Grunt to other build tools - Remove Prepros because it uses AP 4.x - Add Outdated Prefixes section - Fix postcss source-map link - Fix options in README - Merge pull request #49 from stevemao/patch-2 Fix options in README - Merge pull request #48 from stevemao/patch-1 Fix postcss source-map link - Update dependencies - Add appearance support - Add postcss-plugin ketword - Use PostCSS 4.1 plugin API - Deprecate process() method - Add add option - Add prefixes cache - Add warning to ::placeholder - Update README.md to use PostCSS API instead of deprecated internal - Update PostCSS and Can I Use - Warn on display: box - Prefix pixelated instead of crisp-edges - Warn on old crisp-edges value - Add warning about gradient direction syntax - Add PostCSS Runner Guidelines - Prefix only none appearance value - Fix text-decoration prefixes - Better gradients tests - Update Can I Use database - Faster clone - Add cascade to cache key - Fix cascade in cache key - Sudo-less install instructions - Add prefixes only for ::placeholder - Update npm dependencies - Add position to gradient warning - Do not show warnings on outdated prefixes - Update Can I Use data - Use uppercase names for all docs - Clean up README.md - Clean up README.md - Fix links order - Update npm dependencies - Releasee 5.2 version - Corrects postcss cli command for documentation - Merge pull request #456 from DanielGarcia-Carrillo/patch-1 Corrects postcss cli command for documentation - Readd back Prepros in tools - Fix CodeKit link - Merge pull request #458 from postcss/prepros Readd back Prepros in tools - Add Grunt usage example - Add Options section in readme - Merge pull request #459 from hudochenkov/master Add Grunt usage example and Options section in readme - Clean up docs - Fix link - Mention flexboxfixer and gradientfixer in autoprefixer docs - Merge pull request #461 from hallvors/patch-1 Mention flexboxfixer and gradientfixer in autoprefixer docs - Clean up unprefixed FAQ - Clean up links - Minor Typo Figured as long as I saw it... - Merge pull request #466 from badisa/patch-2 Minor Typo - Update dependencies - Add postcss-unprefix - Fix issue occuring when '_autoprefixerDisabled' is undefined This error is thrown when `node` doesn't have the property of `_autoprefixerDisabled`: [TypeError: Cannot read property '_autoprefixerDisabled' of undefined] ref: css-modules/css-modulesify#13 & css-modules/css-modulesify#13 (comment) 0088 - Update dependencies - Merge pull request #57 from joshgillies/bug Fix issue occuring when '_autoprefixerDisabled' is undefined - Release 5.2.1 version - fix typo - Merge pull request #58 from evilebottnawi/patch-1 fix typo - comment copy-past error - Merge pull request #59 from evilebottnawi/patch-2 comment copy-past error - Edit README.md - Merge pull request #469 from michaelbeil/patch-1 Edit README.md - Fix line breaks - Consistently pluralize 'versions' to match Browserslist usage - Merge pull request #472 from maxmechanic/docs Consistently pluralize 'versions' to match Browserslist usage - Update dependencies - Fix broken link - fix typo error of sample code at section Outdated Prefixes - Merge pull request #484 from helm168/master fix typo error of sample code at section Outdated Prefixes - Add backdrop-filter support (fix postcss/autoprefixer#495) - Add filter() function support - Add element() function support - Fix typo - Add EOF to test files - Update dependencies - update grunt example The current grunt example is wrong. The commit updates the example with correct use of loadNpmTasks. Fixes #490 - Merge pull request #499 from renestalder/patch-1 update grunt example - Upgrade to postcss 5.* - Update dependencies - Merge branch 'master' of https://github.com/iamvdo/autoprefixer-core into next6 - Remove node.js 0.10 from Travis CI - Merge Autoprefixer and Autoprefixer Core projects - Reduce Usage section - Remove deprecated API - Add Scroll snap points support - Remove old migration warning - Add warnings to docs - Add ::backdrop support - Add CSS Regions support - Use Browserslist 1.0 - Clean up old separation - Shorter link to repository from package.json - Return old name until full merge - Add max-box-image support - Add image-set support - The mask-border property should be in turn. - Must be support image-set(string) to url() - Fix styles indent - Change online demo tool - Add .editorconf - Fix image url in -webkit-image-set - Fix removing old pixelated values - Fix old mask-border removing - Fix filter transition behaviour - Add other break-* props to multicolumn hack - Update dependencies - Add writing-mode support - Add cross-fade support - Update CoffeeScript - Typo - Join projects - Fix IE writing-mode data - Show gradient warning even if there is no gradient prefixes - Fixed typo in browser options IOS 7 should be IE 7 - Merge pull request #509 from nickspielgist/patch-1 Fixed typo in browser options - Update Can I Use dependency - Release 6.0 version - Add few points to 6.0 changes - Fix cross-fade() not support <number> - Merge pull request #510 from yisibl/fix-cross-fade Fix cross-fade() not support `<number>` - Update Can I Use dependencies - Release 6.0.1 version - Remove -khtml-border-radius too - Update dependencies - Remove -khtml-user-select and -khtml-box-shadow - Remove -khtml- prefix from animations properties - Release 6.0.2 version - Fixed typo: "directiom" should be "direction" - Merge pull request #512 from robhowell/patch-1 Fixed typo: "directiom" should be "direction" - Fix link in options section in README. - Merge pull request #515 from Andersos/patch-1 Fix link in options section in README. - Update dependencies - Fix gradient direction warning - Release 6.0.3 version
Placeholder PR to add support for configurable PostCSS Plugins.
Ref: #12