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

Variables update #6

Closed
eduarddotgg opened this issue Jul 12, 2015 · 7 comments
Closed

Variables update #6

eduarddotgg opened this issue Jul 12, 2015 · 7 comments

Comments

@eduarddotgg
Copy link

When creating or updating variables webpack server needs to be restarted to update variables values.

@serkanyersen
Copy link

this happens when you import _variables.css kind of files. Since they are not imported in the javascript code, webpack won't track changes on these files and rebuild will not trigger. to trigger a build you either need restart the server or go ahead and make a change on all files that imports _variables.css

I was going to create this issue but I see that it's already here. SASS doesn't have this problem at the moment.

@zzq889
Copy link

zzq889 commented Oct 23, 2015

+1
The recent update of postcss-import add addDependencyTo option which allow hot reload for webpack.
Any idea to support the same feature or just replace the current postcss-partial-import ?

@jonathantneal
Copy link
Collaborator

@zzq889, could you explain addDependencyTo? The feature is a week old in postcss-import. Also, if I replace the current postcss-partial-import with postcss-import then we lose caching and the ability to do this:

@import 'components/panel';

@zzq889
Copy link

zzq889 commented Oct 23, 2015

I've found postcss-import could support hot reload with postcss-loader in webpack:

postcss: function (webpack) {
    return [
        postcssImport({
            addDependencyTo: webpack
        })
    ];
}

I think the issue is related to the css modules.

{
  test: /\.scss$/,
  loader: 'style!css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss',
  exclude: /node_modules/
}

When I modify the _variables.css it won't trigger build. I do test with sass-loader and it just works as I expected.

@volochiy-s
Copy link

Hi guys, any solutions or workarounds on that ?

@volochiy-s
Copy link

If someone else is looking for the workaround - I replaced postcss-partial-import with postcss-import and "addDependencyTo: webpack" and that did the trick for me

@jonathantneal
Copy link
Collaborator

FWIW, this is now something you can do. https://github.com/jonathantneal/postcss-advanced-variables/#variables-1

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

5 participants