Jekyll build process example using npm scripts to build assets/js/main.min.js
. The scripts copies vendor sass partials to _sass/vendor/
directory and vendor javascripts to assets/js/vendor/
directory, concatenates and minifies js files and watches for changes.
npm install
in theme root directory, this will install all SCSS and JS dependencies, compress and concatenate JS scripts into main.min.js
.npm install
npm run watch
{
"name": "jekyll-theme-plus",
"version": "1.0.0",
"description": "Advanced Jekyll theme",
"repository": {
"type": "git",
"url": "https://github.com/ivanchromjak/jekyll-theme-plus.git"
},
"author": "Ivan Chromjak",
"license": "MIT",
"bugs": {
"url": "https://github.com/ivanchromjak/jekyll-theme-plus/issues"
},
"homepage": "https://plus.jekyll.plus",
"dependencies": {
"simple-jekyll-search": "^1.5.0",
"system-font-css": "^2.0.1",
"uikit": "^3.0.0-beta.31"
},
"devDependencies": {
"cpx": "^1.5.0",
"jshint": "^2.9.5",
"ncp": "latest",
"onchange": "^3.3.0",
"uglify-js": "^3.2.1"
},
"scripts": {
"copy:sass": "ncp node_modules/uikit/src/scss/ _sass/vendor/uikit/ && ncp node_modules/system-font-css/ _sass/vendor/system-font-css/",
"copy:js": "cpx \"node_modules/uikit/dist/js/uikit.js\" assets/js/vendor/ && cpx \"node_modules/uikit/dist/js/uikit-icons.js\" assets/js/vendor/ && cpx \"node_modules/simple-jekyll-search/dest/simple-jekyll-search.js\" assets/js/vendor/",
"lint": "jshint assets/js/_main.js",
"uglify": "uglifyjs assets/js/vendor/uikit.js assets/js/vendor/uikit-icons.js assets/js/vendor/simple-jekyll-search.js assets/js/_main.js -m -c -o assets/js/main.min.js",
"build": "npm run lint && npm run uglify",
"watch": "onchange \"assets/js/**/*.js\" -e \"assets/js/main.min.js\" -- npm run build",
"postinstall": "npm run copy:sass && npm run copy:js && npm run build"
}
}