Skip to content
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

How to process file outside project directory? #172

Closed
breezewish opened this issue Feb 11, 2017 · 3 comments
Closed

How to process file outside project directory? #172

breezewish opened this issue Feb 11, 2017 · 3 comments

Comments

@breezewish
Copy link

breezewish commented Feb 11, 2017

webpack 2.

+ Project_1
  - style.css
+ Project_2
  - node_modules
  - index.js
  - webpack.config.js
  - postcss.config.js

Directory Project_1 is shared and cannot be modified.

Inside Project_2, when referencing Project_1/style.css, Error: No PostCSS Config found in Project_1/.. is always thrown if no options is given in the loader (notice that postcss.config.js is not resolved).

And as we all known, passing options to the loader usually breaks because many loaders (for example, vue-loader) stringify the options and plugin got lost. Thus I cannot pass options to the loader either.

How can this be solved?

@ai
Copy link
Contributor

ai commented Feb 11, 2017

Just put postcss.config.js to Project_1. The whole idea of postcss.config.js is to store plugins to process file with the files.

So if you will start to use Project_1 in some new Project_3 you will be free to remembering what plugins do I need to Project_1’s files.

@ai
Copy link
Contributor

ai commented Feb 11, 2017

Advice about was from things like PreCSS. If you need just project-specific tools, like Autoprefixer. You should pass plugins as options to loader (there is no other way).

@ai ai closed this as completed Feb 11, 2017
@breezewish
Copy link
Author

Ok, figured out config path can be specified. To help others with similar demands: use options.config to specify a config directory.

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

No branches or pull requests

2 participants