Comments (10)
Shipped in 1.2.0
from postcss-modules-values-replace.
I managed to implement this, still need some refactor, but will try to open PR tomorrow :)
from postcss-modules-values-replace.
Great idea! I'd add some resolve function call in walkFile
.
from postcss-modules-values-replace.
+1 this can be great. Also, nice work @princed. Although, how do I use this? I'm using webpack's css-loader.
from postcss-modules-values-replace.
@kumarharsh Thanks! See usage examples in README, you have to use postcss-loader.
from postcss-modules-values-replace.
@princed here's my config:
/* webpack.config.js */
{
test: /\.css$/,
exclude: path.resolve('./node_modules'),
loaders: [
'style-loader',
'css-loader?modules&camelCase&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
'postcss-loader',
],
},
/* postcss.config.js */
module.exports = {
plugins: [
require('postcss-import'),
require('postcss-modules-values-replace'),
require('postcss-custom-properties')(),
require('postcss-color-function'),
require('autoprefixer'),
],
};
Also, I'm guessing the part in the README about:
{
postcss: webpack => [
require('postcss-modules-values-replace')({fs: webpack._compiler.inputFileSystem}),
require('postcss-calc')
]
}
is optional, and has to be written in the webpack configuration? Because my postcss config is a separate json file. I made a mistake, it's a JS file.
But when I use @value
in my code, the values don't get replaced. If I disable your plugin the @value
do get replaced.
from postcss-modules-values-replace.
@rpunkfu can you share some version of the working code? I'd like to use it too in my project, but am not really fluent in webpack/postcss internals. Maybe I can help a little in the refactor...
from postcss-modules-values-replace.
I managed to implement this feature but, I didnt manage to get hot reload working, when changing file imported via @value
rule, I dont really see way to do it and lack of this feature makes this plugin useless for me :(
from postcss-modules-values-replace.
I deleted code, but maybe I will try to work on it again and share code for others, who doesnt care about feature mentioned above :)
from postcss-modules-values-replace.
@princed I'm still getting the same error Module build failed: Error: Can't resolve 'css/shared/colors.css' in ....
. I have resolve.modulesDirectories
set to ['src', 'node_modules']
in webpack config.
from postcss-modules-values-replace.
Related Issues (20)
- Cannot import value from node_modules HOT 3
- An in-range update of eslint-config-airbnb-base is breaking the build 🚨 HOT 3
- An in-range update of enhanced-resolve is breaking the build 🚨 HOT 2
- An in-range update of postcss is breaking the build 🚨 HOT 3
- An in-range update of babel-polyfill is breaking the build 🚨 HOT 1
- An in-range update of babel-core is breaking the build 🚨 HOT 1
- An in-range update of babel-register is breaking the build 🚨 HOT 1
- Configuration question HOT 11
- An in-range update of babel-cli is breaking the build 🚨 HOT 1
- Do not replace url() function content
- Values aren't replaced in expressions without spaces HOT 1
- It stopped working inside media queries HOT 2
- Incorrect node version requirement HOT 4
- How to remove values completely? HOT 3
- Ignore unused values to boost performance HOT 1
- Export regexes as the rules to reuse by other tools HOT 4
- Upgrade to PostCSS 8 HOT 1
- It breaks on “space toggle hack” HOT 2
- Why does this module depend on node >= 6.5? HOT 2
- An in-range update of eslint-plugin-import is breaking the build 🚨 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcss-modules-values-replace.