In project root dir run gulp [command] --[theme] --[arguments]
Avaliable commands:
babel Compile ES6+ to ES5
clean Remove cached files (pub/static/*, var/*)
critical Compile critical css
default, help Display this help message
exec Republishes symlinks to the source files
less Compile LESS to CSS
watch-scripts Watch for src/*.js files
watch-styles Watch for *.less files
Options:
--[package] Package name (optional field). Need to be the first option. Ex.: --blank
--min Minify css files
--map Add maping to CSS files
--live Enable livereload
--bs Enable browsersync
Examples:
Removes the theme related static files in the pub/static and var directories, republishes symlinks to the source files to the pub/static/frontend/ directory and compiles CSS files using the symlinks published in the pub/static/frontend/ directory with source map and minification.
Compiles CSS files using the symlinks published in the pub/static/frontend/ directory with source map.
gulp less --luma --map
Watch styles with livereload (LiveReload browser extension should be installed)
gulp watch-styles --luma --live
Creates critical.css from styles-l.css and styles-m.css and put it to app/design/frontend/<VandorName>/<ThemeName>/web/css.
In production mode should be run after php bin/magento s:s:d (task uses pub/static/deployed_version.txt to create absolute path to the static files)
gulp critical --luma
Note:
ES6 files should be placed at .../web/js/src/*.js. Compiled files will be in the .../web/js/*.js
请发表评论