Working with Gulp
As has been mentioned in previous section, Gulp is a JavaScript task runner. It helps with performing repetitive tasks like minification, compilation, unit testing, linting, etc. This is possible thanks to extensive Gulp Plugins library.
Gulp tasks are already set up for you. They are stored inside Silicon/gulpfile.js. But in order to have access to them via you Command Line tool you will need to install gulp-cli node package. Gulp CLI stands for Gulp Command Line Interface.
To do that type following line in your terminal:
Gulp CLI commands
- gulpornpm run build - this main command will fire default gulp task which includes: launching BrowserSync, moving vendor libraries from node_modules directory to dist folder, javascript, sass compilation and lanching watch task. BrowserSync will create dev server and sync your browser with your code editor. Note: to use other separate tasks explained below you will need to open other Terminal window and leave the one with running server intact.
- gulp clean - as the name implies it cleans assets folder from generated (compiled assests like css, js, vendor libs, etc.)
- gulp vendor - moves vendor libraries from
node_modulesdirectory toassets/vendorfolder. Please check this article explaining how to add new vendor plugin to your project - Installing Vendor plugins with Npm and Gulp - gulp js - compiles ES6 modules from
src/jsfolder, applies polyfill using Babel and then minifies and uglifies mainassets/js/src/theme.jsfile and createstheme.min.jsfile insideassets/jsfolder.theme.min.jsis linked to your HTML document. Babel gives you an opportunity to write ES6 javascript and be sure it will be compiled to ES5 js that has a better support across browsers. - gulp sass:expanded - compiles
.scssfiles into non-minified CSS (css/theme.css). Fromsrctodistfolder. - gulp sass:minified - compiles
.scssfiles into minified CSS (css/theme.min.css). Fromsrctodistfolder. - gulp watch - launches
watchtask. It will watch changes of your.scss/.jsfiles and automatically compile them into.css/.js.
Next steps
Now you when you are equiped with all necessary tools and dev invironment is all set you are ready to dive into Silicon customization.
Take some time to familiarize yourself with Project structure.