-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
change context by using paths array #75
Conversation
Less supports to additional contexts by using a paths array as an option (see http://lesscss.org/usage/#command-line-usage-options). This is only done, if the default context can't be resolved. > If the file in an @import rule does not exist at that exact location, less will look for it at the location(s) passed to this option. You might use this for instance to specify a path to a library which you want to be referenced simply and relatively in the less files. It can be used like this: ``` { test: /\.less$/, loader: `less?sourceMap&paths[]=${additionalDirectoryPath}` } ``` This is a crucial feature to easily integrate webpack into existing projects.
UPDATE: Looks like this works correctly when paired with the When using this patch in Windows, I'm getting failures to resolve the paths inside My file structure is as follows
// File: less\base.less
@import 'cc-css/less/base' // File: node_modules\cc-css\less\base.less
@import 'layout'; Paths config is as follows: paths: [
"e:/git/cc-designer/node_modules"
] Gives an error:
Debugging the code reveals that on Windows, the
Side note: using LESS to compile this works fine, so it's definitely something relating to the way the loaderContext resolution is happening (I think). Any clues? |
What is the status of this issue ? |
less-loader uses a custom implementation as the file-manager for less. Honestly I don't understand why, can't it just cut all of that and simply provide less with the paths to search for via webpack.config (like in the pull request above)? |
Any reason in particular this hasn't been merged yet? I'm not quite following the issue here. |
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix #1791
Add `paths/includePaths` functionality for `sass` and `stylus`. Similar functionality for less is blocked by webpack-contrib/less-loader#75. To add paths, use the new entry in `angular-cli.json` app object: ``` "stylePreprocessorOptions": { "includePaths": [ "style-paths" ] }, ``` Fix angular#1791
how come this hasn't been merged yet? |
This has also been discussed at the sass-loader and I totally understand the motivation. I'm thinking about making the webpack resolution plugin opt-in. It's the source for many errors and often it also makes the build considerably slower (at least Sass, I haven't tested it with Less). |
Starting with less-loader 4, you can now choose between the builtin Less resolver or the webpack resolver. If you specify a It decided to do it that way because specifying the Thx @donaldpipowitch for your efforts. I hope, this change is in your interest. |
Less supports to additional contexts by using a paths array as an option (see http://lesscss.org/usage/#command-line-usage-options). This is only done, if the default context can't be resolved.
It can be used like this:
This is a crucial feature to easily integrate webpack into existing projects.