Npm commands (scripts)
Npm scripts help with performing repetitive tasks like minification, compilation, unit testing, linting, etc. The Silicon build system consists of a variety of JavaScript files, each performing specific tasks, and associated Npm scripts that execute these files.
The list of available Npm commands (scripts)
Command | Description |
---|---|
npm install | This command is used to install Node.js packages and their dependencies in a project. The dependencies are listed in a "package.json" file in the project's root directory, under the "dependencies" and "devDependencies" sections. |
npm run dev | Builds and minifies styles and scripts, copies vendor files from the node_modules directory to the assets/vendor folder, initiates a watch process to detect files changes, and starts a local development server with hot reloading. This is the primary command to utilize when customizing the template. |
npm run build | Builds both expanded and minified versions of styles and scripts, copies vendor files from the node_modules directory to the assets/vendor folder, and runs HTML validation checks. |
npm run styles:expanded | Runs a script to generate expanded theme.css styles and theme.css.map (assets/css) from source .scss files (src/scss). |
npm run styles:minified | Runs a script to generate minified theme.min.css styles and theme.min.css.map (assets/css) from source .scss files (src/scss). |
npm run scripts:expanded | Runs a script to generate expanded theme.js scripts and theme.js.map (assets/js) from source .js files (src/js). |
npm run scripts:minified | Runs a script to generate minified theme.min.js styles and theme.min.js.map (assets/js) from source .js files (src/js). |
npm run vendor | Copies vendor files listed under "dependencies" section in package.json file from the node_modules directory to the assets/vendor folder. |
npm run validate | Executes validation checks on all .html files, ensuring compliance with W3C markup validity rules. This process utilizes the HTML-validate plugin, which is configured through the .htmlvalidate.json file. |
npm run watch | Initiates a watch process to monitor changes in .css , .js , and .html files, simultaneously launching a local development server equipped with hot reloading, powered by Browsersync. |