Install the following node modules (npm) for compiling sass and minifing Javascript.
-
Install node modules globally:
npm install -g gulp-cli
-
Install node modules in the same directory as this readme file.
yarn add autoprefixer browser-sync gulp gulp-sass gulp-postcss gulp-sourcemaps gulp-uglify postcss sass yarn-upgrade-all --dev
-
gulp-local.env file:
- Duplicate
gulp-local.env.sample.js
file and rename itgulp-local.env.js
. - Change vaules in file as needed.
- Duplicate
-
Run script:
gulp
orgulp watch
.
We'll also be linting our sass and Javascript in order to produce well written and consistent code.
- Install node modules in the same directory as this readme file.
yarn add stylelint stylelint-config-sass-guidelines stylelint-config-standard standard --dev
Required lint files (should be added during initial theme setup):
- .eslintrc.json
- .stylelint.json
- .stylelintignore
To do a global lint on the SCSS files run: npx stylelint "scss/**/*.scss"
. To fix found errors add the --fix
flag.
Sublime: install the following packages using package control:
- SublimeLinter
- SublimeLinter-contrib-standard
- SublimeLinter-eslint
- SublimeLinter-stylelint
VS Code: install the following extensions:
Workspace setting should be located at the root of this project's repo: /.vscode/settings.json
{
"eslint.workingDirectories": [
"htdocs/themes/THEMENAME"
],
"stylelint.packageManager": "yarn",
"stylelint.configBasedir": "htdocs/themes/THEMENAME",
"stylelint.configFile": "htdocs/themes/THEMENAME/.stylelintrc.json",
"stylelint.snippet": [
"sass",
"scss"
],
"stylelint.validate": [
"sass",
"scss"
]
}