Available Gulp Tasks
UnderStrap provides a set of gulp tasks to automate compilation and minification of stylesheets and JavaScript.
Make sure you have gulp and node installed.
Please follow instructions provided in Development » Developing with npm and gulp
There is a good amount of Gulp-Tasks available, but you´d probably only want to use a few of them. Most of them are explained below.
Gulp BrowserSync
gulp watch-bsExplanation:
- Triggers BrowserSync to watch any file in the
understrap-folder for changes. - Will autocompile SCSS, Javascript and minify images upon changes.
- Needs setting up
browserSyncOptionsin./gulpconfig.jsoncorrectly.
Gulp sass
gulp sassExplanation:
- Compiles all SCSS files from
./sassinto CSS. Needs to be run manually each time when you want to re-compile SCS into CSS code. - Runs autoprefixer for latest 2 Browser-Versions and generates Sourcemaps.
- Does not minify files. See
gulp cssnano.
Gulp cssnano
gulp cssnanoExplanation:
- Discards all comments.
- Minifies
theme.cssfrom./cssand renames it totheme.min.css. - Leaves the original, human-readable
theme.cssin place.
Gulp minifycss
gulp minifycssExplanation:
- Minifies everything but
theme.cssfrom./cssand renames them to corresponding*.min.css. - Leaves the original, human-readable
*.cssin place.
Gulp cleancss
gulp cleancssExplanation:
- Minifies
theme.cssfrom./cssand renames it totheme.min.css. - Leaves the original, human-readable
theme.cssin place.
Gulp styles
gulp imastylesgeminExplanation:
- Is a task runner that runs
gulp sassandgulp minifycssin a sequence.
Gulp scripts
gulp scriptsExplanation:
- Takes
./src/js/bootstrap4/bootstrap.js,./src/js/skip-link-focus-fix.jsand./src/js/custom-javascript.jsand compiles them into one concatenated file in./js/theme.js. - Will be uglyfied into
./js/theme.min.jsat last.
Gulp imagemin
gulp imageminExplanation:
- Minifies images located in
./src/imgand copies the minified files to./img.
Gulp Generate Distribution
gulp distExplanation:
- Creates a
./distfolder and copies all needed files for distribution as simple theme. - Does not contain any development files (like
./src,./sassor./node_modules).
Gulp Generate Distribution with Production Environment
gulp dist-productExplanation:
- Creates a
./ dist-productfolder and copies all needed files for distribution as a simple theme with all production assets. - Does contain development files like
./srcand./sass.
The following scripts should not be run manually - except when you know exactly what you are doing!
Gulp Clean Sourcecode Folder
gulp clean-sourceExplanation:
- Deletes anything in the
./srcfolder.
Gulp Copy Assets from Bower
gulp copy-assetsExplanation:
- Copy all needed dependency assets files from bower_component assets to themes
./js,./scssand./fontsfolder. - Run this task after bower install or bower update