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

[RFC] Fix source maps #39

Open
1 of 3 tasks
simonexmachina opened this issue Nov 19, 2014 · 2 comments
Open
1 of 3 tasks

[RFC] Fix source maps #39

simonexmachina opened this issue Nov 19, 2014 · 2 comments

Comments

@simonexmachina
Copy link
Collaborator

Currently source maps don't really work in broccoli-sass.

There's two parts to this problem:

  1. Read: the ability to see the source SASS in dev tools
  2. Write: the ability to update the SASS in the dev tools, save your changes to the filesystem and have these changes written to the original source files

The current status is:

  • You can use broccoli-sass to generate source maps (node-sass provides source maps)
  • Unfortunately the mapping in the source map only map back to the source files as node-sass sees them, which may not be the original source files (ie. if you've used broccoli-merge-trees or any other compilation steps)
  • You can use the dev tools to create a mapping to the original source files, but the next time you start broccoli the directory path in tmp/ will have changed and the mapping no longer works.

There are a few potential solutions that have been investigated:

  1. Embed the sources in the source map using sourcesContent. This is supported in libsass now, but hasn't been exposed in node-sass. This solves the read problem, but not write. See this issue for status.
  2. Include the sources in the output tree, for example in output.css.sources/, and mutate the sources property in the source map so that they refer to this directory. This also solves the read problem, but not write. This is not necessary if option 1 works well.
  3. Create our own source map that provides the mapping from the sources files to the files that are provided to libsass and pass this to libsass, which would then append its own transformations to this file. This should allow the dev tools to map all the way back to the source files, which would solve the write problem. The developer would still need to use the workspaces feature to authorise the dev tools to write to the file system. See this issue for status on this.
@simonexmachina simonexmachina changed the title Fix source maps [RFC] Fix source maps Nov 19, 2014
@simonexmachina
Copy link
Collaborator Author

It looks like option 3 will be supported by libsass at some point in the future.

@joliss
Copy link
Owner

joliss commented Feb 27, 2015

We also need to make sure that paths come out correctly in devtools. I opened an issue on libsass: sass/libsass#908

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

2 participants