-
Notifications
You must be signed in to change notification settings - Fork 9
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
Generate compiled stylesheets / js #183
Conversation
[#166] Signed-off-by: Luigi Ray-Montanez <[email protected]>
- Add yui-compressor gem to minify js
- yui-compressor didn't have an option to create source maps, so i tailored a solution from this blog-post: - https://blog.experteer.engineering/generating-sourcemaps-with-sprockets-3-and-uglify.html [#176]
[#176] Signed-off-by: Luigi Ray-Montanez <[email protected]>
[#176] Signed-off-by: Luigi Ray-Montanez <[email protected]>
[#176] Signed-off-by: Luigi Ray-Montanez <[email protected]>
- Turns out this isn't the right way to use sourcemaps but it doesn't break anything so we're going to roll forward. [#176]
[#176] Signed-off-by: Luigi Ray-Montanez <[email protected]>
[#171908579]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly this looks good to me; however, I did encounter some unexpected results when running rake assets:package
.
- I would have expected the file
dist/css/honeycrisp.css
to be a concatenation of all our css files (after conversion from scss). However, instead it seems to be a list of@import
statements. - I would have expected the file
dist/css/honeycrisp.min.css
to be a minified version ofhoneycrisp.css
(i.e. removing comments and whitespace); however, it looks to me likehonecrisp.min.css
is simply a concatenated css file (similar to what I expectedhoneycrisp.css
to be) -- it doesn't look minified to me.
Am I missing something? Let me know!
lib/tasks/distribution.rb
Outdated
assets = sprockets.find_asset(STYLESHEET_PATH) | ||
assets.write_to("#{CSS_PATH}/honeycrisp.css") | ||
|
||
sprockets = create_sprockets_env(compress: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these three lines (48-50) are doing anything -- it seems to behave exactly the same with them commented out...
Ruby sass, which sass-rails relies on was end of life as of 26 Mar 2019. More here: https://sass-lang.com/ruby-sass sassc-rails and SassC are supposed to be good replacements. https://github.com/sass/sassc-rails
In theory we should be able to do this with the SasscCompressor, but I couldn't get it to work so instead just used the SassCEngine directly.
I did some work on this that I think fixes the CSS compilation, minification, and source map creation. Right now
Some things that may be worth following up on:
|
This looks good to me @hartsick. The only update I made was to use style "compressed" fully minify the css file. I played around with getting the sourcemaps loaded in a toy project, but wasn't able to get it to work without monkeying around with the paths a bit (it seems that my browser was expecting the sourcemap file path to be relative to the css file, not relative to the project root; also, I think we might want it to point to the I'm going to merge this PR and call it done for now. We can revisit the sourcemap question if/when we have a need for it. |
#176
Run
rake assets:package
to get the compiled stylesheets, js, and maps for honeycrisp.