Compile CSS from Sass using Webpack#2849
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2849 +/- ##
==========================================
- Coverage 60.46% 60.42% -0.04%
==========================================
Files 605 605
Lines 43801 43708 -93
Branches 48 48
==========================================
- Hits 26483 26412 -71
+ Misses 17306 17284 -22
Partials 12 12 ☔ View full report in Codecov by Sentry. |
ea992a2 to
e6c4790
Compare
36a822e to
f7563ea
Compare
Test results 9 files 9 suites 8m 30s ⏱️ Results for commit 19d7c58. ♻️ This comment has been updated with latest results. |
23a0962 to
f181d52
Compare
|
f181d52 to
60bd9be
Compare
60bd9be to
f36092e
Compare
|
This is a continuation of #2859? I'd rather not review this one until that one is merged and this one updated accordingly. |
f36092e to
f7ec850
Compare
|
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
|
I also notice there is a bunch of deprecation warnings issues by webpack when building the style sheets. Maybe we should make an issue to follow up on these as well... |
|
I'll add that I believe |
Will do 👍
I have added some issues regarding webpack's warnings and suggestions. Will you add issues for no. 2 and 3 or should I go ahead with it? :)
Yes, please ❤️ |
lunkwill42
left a comment
There was a problem hiding this comment.
Me like, but the bit about the sass-watcher should rather go somewhere in doc/hacking/hacking.rst, as it's not something normal users would be interested in.
adc801c to
a76978a
Compare
lunkwill42
left a comment
There was a problem hiding this comment.
Yeah, I think this will do!
Now, all that remains to be seen is if we can get the Debian package build process up to snuff :)
The essence of this config: Sass files will be compiled into CSS files into the same folder (/static/css/) as it was done in the original implementation (with libsass and setuptools). The resulting files in /static/css will have same layout and names as with the previous solution, except for /static/css/foundation folder. It is dropped completely since it was empty when built with setuptools. This is expected since /sass/foundation folder contains only Sass partials. Named webpack configuration is used in the config. This is to drop the need of having multiple webpack config files per name/target/purpose.
* Fixes failing assets urls. Read more about problem here https://webpack.js.org/loaders/sass-loader/#problems-with-url. In our case asset urls must be relative to each given entry path (each generated CSS file came from a separate entry). Sass files (entries) have different path depth which introduces another problem - there can't be 1 variable that would satisfy all entries. Furthermore, some assets are defined in the same Sass file AND are used by several entries of varying depth. squash Fix correct asset name and path * Remove redundant imports Otherwise webpack will fail due to assets url not being valid relative to entry path * Fix correct import Otherwise webpack would not build CSS file from entries Also merges duplicate selector definitions into single definition. There were no overlaps in the merged definitions, so no unexpected CSS behaviour would occur. But merging duplicate definitions is better for code maintainability in general.
c39cd60 to
e1cebe3
Compare
Also whitelists make cmd for testing
Co-authored-by: Morten Brekkevold <morten.brekkevold@sikt.no>
* Updates docs about sass-watcher process in docker * Adds docs about hacking CSS * Adds docs on how to build CSS from Sass when building NAV from source
e1cebe3 to
19d7c58
Compare
|




Implemented changes:
Closes #2871, and #2719
Best reviewed commit-by-commit. Furthermore this PR could be split into several smaller PRs.
Further work:
Depends on #2855, #2859