Work on CSS#
Start Storybook and Webpack for CSS Work#
- Make sure sourcemaps are visible on local. Sourcemaps allow you to see the correct .scss file in inspector.
- Go to /admin/config/development/performance
- Turn off CSS/JS aggregation for your local environment. Aggregation strips out comments, which is how sourcemaps get added.
-
Do NOT export and commit this change.
-
In terminal, go to the theme folder:
cd /web/themes/custom/npl/
-
Make sure there is a .nvmrc folder in /cusom/npl.
ls -la
-
Run command to switch to the current node version needed:
nvm use
-
Run command to ensure emulsify stuff installed:
npm install
-
Start the listener before updating scss files:
npm run develop
-
Make changes to scss files.
Stop Storybook and Webpack and Commit Work#
-
When you are done developing, hit ctrl-C to turn off the SCSS watch process.
control + C -
Check status:
git status -s
-
Reset all files except the specific files you made changes to - e.g. the SCSS files. Reset any js or css files that were generated.
git checkout -- [file]
-
Final step is to then run a build process. This will produce a smaller set of changed files.
npm run build
-
Commit the SCSS and the new rendered CSS file. Reset all the other files that were not changed.
- Commit the altered scss files.
- Commit the compiled css files last in a separate commit.
-
Do not commit the other compiled files. For any file .
-
Verify your changes are still visible on the affected web page.
-
Push up your changes for testing.
At some point, we can work on some cleanup so we aren't generating all these unknown changes but for now, the process above should work fine.
Let us know if you want a call to walk through this. It can be a bit confusing.