-
Notifications
You must be signed in to change notification settings - Fork 93
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
Allow setting context via command line #52
Comments
@michael-ciniawsky ping? |
I currently expose the postcss src/index.sss -o dest/index.css -p sugarss -m -e 'production' module.exports = ({ options, file, env }) => ({
parser: file.extname === '.sss' ? options.parser : false
map: options.map || { inline: true }
plugins: {
'postcss-import': { root: file.dirname }
'cssnano': env === 'prodution' ? {} : false
}
}) The following is not working and is a mess, how did postcss-cli v2 postcss -u || --ctx { key: value } |
@michael-ciniawsky So what are we doing here? |
Options can be set via the CLI, only plugin options must be defined in the config itself postcss -m -p -t -s postcss.config.js module.exports = (ctx) => ({
map: cts.options.map || fallback,
parser: ctx.options.parser || fallback,
syntax: ctx.options. syntax,
stringifier: ctx.options.stringifier
plugins: {...plugins}
}) |
So we don't need custom context? |
Well It would into the direction like module.exports = (ctx) => ({
map: cts.options.map || fallback,
parser: ctx.options.parser || fallback,
syntax: ctx.options. syntax,
stringifier: ctx.options.stringifier,
plugins: {
'posthtml-plugin': ctx.options.plugin
}
}) |
👍 Perhaps should be Can you document what's currently available via |
Yep |
Fixed by #86 |
As mentioned in #51.
Currently, we have
--env
to allow settingprocess.env.NODE_ENV
forpostcss.config.js
. We also have command-line flags to override the syntax, parser, stringifier, & map options specified in the config.We should have an additional command-line flag to allow passing other values via
ctx
topostcss.config.js
.My strawman proposal:
This needs discussion.
The text was updated successfully, but these errors were encountered: