-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
sourceRoot option #240
Comments
@w0rm do we really need it? |
@ai this is not really critical, I don't mind keeping it as it is now. |
i think we can live without this feature. Anyway PR will be welcome. |
@ai We need this feature. Error in plugin 'css-rebase-urls'
Message:
"themes/insteria/font-awesome/less/path.less" is not in the SourceMap. Real path "src/themes/insteria/font-awesome/less/path.less"
Before less compile and concat css. Some files in less format, some in css format. |
in fast way i use this code decl.source.input.map.consumer().sourceRoot = '/my/path/to/source';
// Some logics...
decl.source.input.map.consumer().sourceRoot = null; but it is bad code :(. Maybe someone you know can help |
Hmm ran into this with our build tool (https://github.com/exmg/nbob) as well. Patching it for now like the gulp-postcss plugin does (as mentioned above), but would enjoy an option for this as well. |
Welcome for PR :D |
@ai need feature, because using |
@evilebottnawi Doesn't need at all. Where did you find that? |
@TrySound find what? Problem? (postcss/gulp-postcss#64) |
@evilebottnawi Using with postcss-import |
@TrySound sorry, |
@evilebottnawi postcss-import do not need this option. It handle only |
@TrySound https://github.com/geut/postcss-copy/blob/master/src/index.js#L292 get options from |
@evilebottnawi |
@TrySound i know, about this issue postcss/gulp-postcss#64 (comment), if i set option |
@evilebottnawi I see, but your mention to |
@TrySound I made a mistake and then correct it, be sure to focus on this rather than on solving the problem? |
That's what I wanted to see.:) |
@TrySound maybe help or just offtop? |
I response for |
To fix sindresorhus/gulp-autoprefixer#55 we need this. I did a pull-request (sindresorhus/gulp-autoprefixer#61) but as seen in the comments from the owner, it should be fixed here, as other plugin authors will benefit as well, from this change. |
@Saturate can you make a PR here? |
@ai I'll have a look at it later. |
@Saturate it is last version for 5.1 release :) |
While this is being looked at, should an extensions array option be added as well? See: postcss/postcss-import#52 and madyankin/postcss-modules#13 Haven't looked in depth at the proposed solutions yet, but perhaps a simple and elegant solution would be to handle file resolving in PostCSS rather than passing down additional parameters to the plugins, so perhaps PostCSS could pass down a resolving function in the API's opts object? that function would return an absolute file path or an error if the file was not found. |
@tarikihm |
Got it, sorry I skimmed through a bit too quickly, still, is there a way to avoid having to pass file resolving options to each plugin? Would it make sense that it gets handled/supervised by PostCSS? |
@tarikihm open a new issue for it. |
OK. I will close this issue again if nobody want to implement it. |
Here's a workaround: const res = await postcss().process(code, opts);
res.map._sourceRoot = '/path/to/root';
assert(res.map.toJSON().sourceRoot == res.map._sourceRoot); The |
We need to add
sourceRoot
option to map generator.For example, right now gulp-postcss change root of
sources
manually. Option will be very helpful in this case./cc @w0rm
The text was updated successfully, but these errors were encountered: