-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Sourcemaps #346
base: master
Are you sure you want to change the base?
Sourcemaps #346
Conversation
Any thoughts on this? Would be interested to hear if you think this approach is good, then I can invest more time in getting these architecture changes back upstream. Thanks. |
I'm not fond of passing |
@cyberdelia Good catch, it turned out passing in Haven't looked at adding this support to compilers yet. |
Another issue I just realized: putting the source map's filename in the source makes it tricky to use Django's staticfiles hashed filenames. I see one possible solution: add post-processing to the staticfiles storage classes to rewrite source map filenames in the source files. This sucks, but I'm not sure how to avoid this - thoughts? |
Oh d'oh we can just extend the |
@aehlke would you mind bringing me up to speed on what you're trying to do here / how you're trying to do it? I see you're talking about hashed filenames above - does that mean you're trying to get sourcemaps working in a production environment? I've only just discovered the existence of sourcemaps, but my understanding is that they're mostly useful in development when you're trying to look at compiled (not compressed) output in Chrome DevTools or similar. In my situation, I'd like to use them with Sass as described here and don't care about using them in production - just need to be able to see my partials in DevTools instead of the compiled CSS. This actually mostly works out of the box just by adding this setting: The part that doesn't completely work is if I want to have Chrome show me the partial's source (& let me live-edit it if I'm using the Workspaces feature). It works (coincidentally) for partials that are in the same app static directory as the sourcemap file, but for other app static directories it doesn't work because Sass has no clue about Django's static URL conventions. See what I mean here: http://d.pr/i/sqX8 In the When what I really need is this: So, based on my very limited understanding/experience with sourcemaps, all I need to do to get this working perfectly in development is rewrite some of the URLs in the This is the approach that these guys are using: sindresorhus/gulp-ruby-sass#68 In the case of django-pipeline, couldn't that just be a new setting that holds a regex to replace with Sorry for long comment. What do you think? |
@danxshap I haven't looked into SASS yet (and FYI your |
@danxshap The reason I care about using sourcemaps in production though is that we'd like to use Sentry (https://www.getsentry.com/) for our JS and have meaningful/readable tracebacks in the errors we log. |
@aehlke got it. I don't know how sourcemaps work for JS files, but if they can map an exception in a concatenated, compiled (coffeescript?), and minified file to the specific line number in the individual, uncompiled & un-minified file - that is amazing! Looking forward to trying out what you come up with. In the mean time, I've decided to use this solution for Sass in my own project which is working great in development (in case anyone stumbles upon this and has the same issue): https://gist.github.com/danxshap/193a74609291150c216d |
@danxshap Indeed, Google's Closure compiler for JS can take a list of JS files and output a single concatenated/minified file and a source map to go with it. :) The solution you linked looks like it'll work, but it could extend the built-in way Django has for rewriting URLs in collectstatic post-processing. I implemented this in my own codebase yesterday but unfortunately it's blocked on a bug in Django that I've made a PR for: django/django#2895 It's easy to back-port this bugfix but it's a big chunk of code to bundle with django-pipeline... |
@cyberdelia I've removed the passing-around of |
Add new setting in order to control concurrency in virtualized environments.
This isn't ready to merge as is, but this fork adds the groundwork needed for generating source maps for JS/CSS. I haven't included my plugin for Closure, but you can see the interface in the changes below (which are pretty minimal). Sharing this to get your input, maybe this can be adapted to some way you prefer.