Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Setting preset-env options? #127

Open
marr opened this issue Jan 9, 2019 · 3 comments
Open

Setting preset-env options? #127

marr opened this issue Jan 9, 2019 · 3 comments

Comments

@marr
Copy link

marr commented Jan 9, 2019

Hi, thanks for this plugin [collection]. I am trying to set the importFrom option for the preset-env plugin. Are those options set at the root, or is there a prefix that we need to know about?

My postcss.config.js looks like this:

import precss from 'precss';
const options = {
  importFrom: './variables.css',
}
module.exports = () => ({
  plugins: [precss(options)]
})

However, the css I'm compiling appears not to find the variables declared in variables.css.

@luislhl
Copy link

luislhl commented Mar 25, 2019

Hello, @marr .

I had the same doubt, but by reading the way options are passed to the plugins, it seems that every option is passed to every plugin: https://github.com/jonathantneal/precss/blob/master/src/index.js

So all you have to do is to set the options at the root.

I guess there are no collisions between options names across plugins, otherwise it should be problematic.

@5lava
Copy link

5lava commented Apr 10, 2019

There are some collisions. For example, postcss-custom-properties and postcss-custom-media share the same option names preserve, importFrom, exportTo.

Documentation at https://github.com/jonathantneal/precss/wiki/Options refers to version 2.0.0. Starting from 3.0.0 there's no way to split options. As @luislhl said, every option is passed to every plugin.

@diverent2
Copy link

Hello there,

I´ve been working on solving this problem, currently waiting for feedback on my PR #132
Will keep you guys updated!

Have a good one :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants