MadLittleMods / postcss-css-variables

PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation
https://madlittlemods.github.io/postcss-css-variables/playground/
Other
536 stars 62 forks source link

postcss-loader config information #118

Open jonybuzz opened 4 years ago

jonybuzz commented 4 years ago

I have a postcss.config.js file like this:

module.exports = {
    plugins: {
        'postcss-preset-env': { },
    },
};

What would be the best way to include post-css-variables? As a plugin of postcss or postcss-preset-env

Either way i´m having this error:

ERROR in ./node_modules/framework7/css/framework7.bundle.css (./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src!./node_modules/framework7/css/framework7.bundle.css)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: Cannot read property 'indexOf' of undefined
    at path\to\project\node_modules\framework7\css\framework7.bundle.css:2813:3
    at path\to\project\node_modules\postcss-initial\index.js:20:22
    at path\to\project\node_modules\postcss\lib\container.js:190:18
    at path\to\project\node_modules\postcss\lib\container.js:135:18
    at Rule.each (path\to\project\node_modules\postcss\lib\container.js:101:16)
    at Rule.walk (path\to\project\node_modules\postcss\lib\container.js:131:17)
    at path\to\project\node_modules\postcss\lib\container.js:148:24
    at AtRule.each (path\to\project\node_modules\postcss\lib\container.js:101:16)
    at AtRule.walk (path\to\project\node_modules\postcss\lib\container.js:131:17)
    at path\to\project\node_modules\postcss\lib\container.js:148:24
    at Root.each (path\to\project\node_modules\postcss\lib\container.js:101:16)
    at Root.walk (path\to\project\node_modules\postcss\lib\container.js:131:17)
    at Root.walkDecls (path\to\project\node_modules\postcss\lib\container.js:188:19)
    at Object.plugin (path\to\project\node_modules\postcss-initial\index.js:19:9)
    at promise.then (path\to\project\node_modules\postcss-preset-env\index.js:443:97)
 @ .\node_modules\framework7\css\framework7.bundle.css 2:26-125 22:4-35:5 25:25-124
 @ .\src\js\app.js
 @ multi .\src\js\app.js

I want to discard that this is a postcss-loader or webpack problem

jonybuzz commented 4 years ago

BTW this is the file where it fails https://github.com/framework7io/framework7/blob/v5.4.5/packages/core/css/framework7.bundle.css

MadLittleMods commented 4 years ago

Is this a postcss-css-variables problem?

Looking at the usage on https://github.com/postcss/postcss-loader#usage, it seems like you can do this:

module.exports = {
    plugins: {
        'postcss-css-variables': { },
    },
};