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
Add CSS postprocessor to support variables #53
Conversation
@zolhorvath Please add at least one reviewer to get your code review and merge. |
@kiran-kadam911 Sadly, I cannot add reviewers. |
From #52's review:
|
Thank you! I think the option 1 sounds good 👍 |
I'm on this :) |
Ignore distributed CSS Change url references (follow new directory structure)
@lauriii Could you please re-check? |
package.json
Outdated
@@ -13,16 +13,34 @@ | |||
"lint:js": "node ./node_modules/eslint/bin/eslint.js .", | |||
"lint:js-passing": "node ./node_modules/eslint/bin/eslint.js --quiet --config=.eslintrc.passing.json .", | |||
"lint:js-stats": "node ./node_modules/eslint/bin/eslint.js --format=./scripts/js/eslint-stats-by-type.js .", | |||
"lint:css": "stylelint \"**/*.css\"", | |||
"lint:css-checkstyle": "stylelint \"**/*.css\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js" | |||
"lint:css": "stylelint \"css/dist/**/*.css\"", |
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.
Why are we linting the compiled CSS files?
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.
Changed to css/src/**/*.css
.
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.
Looks good! Thanks for making all the requested changes 😊
@zolhorvath If we are going to use CSS-Preprocessor then we need to install an SCSS parser for PostCSS right? @lauriii please guide/suggest. |
@kiran-kadam911 This PR already introduced a dependency to https://github.com/postcss/postcss-custom-properties which will allow us to use variables. I don't think we should introduce a dependency to SCSS parser at least now. |
@zolhorvath as per current theme structure for Seven's assets from |
Why (Motivation)
To speed up (and simplify) development I think that having a CSS preprocessor(#52) or a CSS postprocessor(#53) would be useful, especially for storing main variables like colors, dimensions (e.g. input-border width, border radius).
This PR adds a PostCSS-based postprocessor for this project.
Technical summary
Basics
./css/
are copied to./source/css/
. At the end of the processing, these are compiled into the./dist-css/
directory../css
directory is kept to make further git merges as easy as possible.If a new CSS file gets in by a merge, it should be copied to
./source/css/
and it's reference should be changed in the.info.yml
or in the.libraries.yml
.Scaffolding
New CSS scaffolding tasks are following the logic of the
js
tasks:yarn build:css
:Process sources without source maps.
yarn build:css-dev
:Process sources with (external) source maps.
yarn watch:css
:Watches source assets and applies distributive task if any of them changes.
yarn watch:css-dev
:Watches source assets and applies development task if any of them changes.
Miscellaneous Notes
Current config supports less browsers than the stylelint config:
firefox >= 16
instead offirefox >= 5
opera >= 15
instead ofopera >= 12
These where added to
package.json
.Workarounds
core/misc
should be symlinked two level above this project's folder.For instance, if this theme is placed to
[docroot]/themes/custom/seven
, then[docroot]/core/misc
should be symlinked to[docroot]/themes/misc
.