Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow specifying a directory for sourcemaps #216

Closed
wants to merge 2 commits into from
Closed

Allow specifying a directory for sourcemaps #216

wants to merge 2 commits into from

Conversation

rarila
Copy link

@rarila rarila commented May 31, 2015

At the moment there doesn't seem to be a way to get the sourcemaps generated in another directory than the source directory when you process multiple files in one target like:

        files: [
            {
                src:  'app.scss',
                dest: 'app.css'
            }, {
                src:  'lib.scss',
                dest: 'lib.css'
            }
        ]

With this patch if the sourceMap option ends with / (or \) …

        options: {
            sourceMap: 'path/to/maps/'
        },

… it is treated as directory and the sourcemap is named after the destination file with .map added.

With the example above you would get the following files generated in the end:

app.css
lib.css
path/to/maps/app.css.map
path/to/maps/lib.css.map

Another way to achieve this would have been to add a option like sourceMapDir, but I thought this way it won't clash with existing behavior or possible extension of node-sass with sourceMapDir.

@sindresorhus
Copy link
Owner

Should be fixed in node-sass, not here. https://github.com/sass/node-sass

@rarila
Copy link
Author

rarila commented May 31, 2015

I apologise for digging deeper. You are correct, insofar as it could be be fixed upstream. But the actual problem is introduced by grunt-sass as it adds multiple files functionality to node-sass's one-file per call interface. So I think its definitely legitimate to fix that here.

@bobdenotter
Copy link

👍 Would be great if it was fixed here, in grunt-sass.

@sindresorhus
Copy link
Owner

grunt-sass is far from the only node-sass consumer to use it for multiple files, better to fix it in node-sass so everyone benefits from it.

@rarila
Copy link
Author

rarila commented May 31, 2015

I doubt it will be fixed there. They seem to be in the opinion the calling party should do as they just did it for their CLI interface (sass/node-sass#903) and didn't add that to the sourceMap option.

@xzyfer
Copy link
Contributor

xzyfer commented May 31, 2015

I'm sorry, what exactly is the issue? node-sass has mutlifile compilation and sourcemap support.

Please present a clear scenario and your expectations. As far as I understand what you're asking for should be possible in node-sass as of sass/node-sass#903.

@xzyfer
Copy link
Contributor

xzyfer commented May 31, 2015

didn't add that to the sourceMap option

This is incorrect. The CLI backs on to our public API. We update the sourceMap option to support sourcemaps for a compiled directory.

https://github.com/sass/node-sass/pull/964/files#diff-c19ab2481e2703fcf0d2808f4c762f63R190

possible extension of node-sass with sourceMapDir

We could do this, however I suspect it not work as expected. Grunt allows you to gather files from many different sources, so I suspect we'd have issues mirroring the directory semantics in the sourcemaps directory for everyone.


@sindresorhus IMO this is a grunt-sass specific issue. Node sass supports compile a single file or an entire directory, and we create sourcemaps for both use cases. Since grunt sass uses grunt's file globbing semantics it needs to correctly set the sourceMap directory per file.

@CarsonF
Copy link

CarsonF commented Nov 24, 2015

@sindresorhus I just ran into this problem too. It would be great if you would merge this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants