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

Keep original comments from less file #14

Open
kriku opened this issue Oct 20, 2018 · 0 comments
Open

Keep original comments from less file #14

kriku opened this issue Oct 20, 2018 · 0 comments

Comments

@kriku
Copy link

kriku commented Oct 20, 2018

It'll be useful to keep original comments when doing customization.

I mean in example like this, I have to use less-loader modifyVars to customize theme.. It could be like:

// webpack configuration
const paletteLess = fs.readFileSync(LESS_FILE, 'utf8');
const palette = lessToJs(paletteLess);
... 
// less-loader options
    ...    modifyVars: palette
...

In this case I don't work with js object directly, but also I couldn't set variables in less file with js functions... So I prefer use lessToJs explicitly, to form js file, then I can use nodejs and webpack power for doing different tricks:

// palette.js
const colors = require('./colors.json');

module.exports = {
    '@normal-color': colors['Light Black'],
    '@primary-color': colors['Blue'],
    // and all power of importing JSON to variables, or js functions and so on
};

Trick with colors.json in particular, caused by the inability import es modules from react-app to webpack configuration, but it fine to import json in both...

But anyway, it would be helpful if you add option to save original comments from less file.

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

1 participant