Marketing site for M2 utilizing Jekyll, Gulp, ECMAScript(latest), webpack3, sass and postcss.
- Features
- Installation
- Getting Started
- List of Gulp tasks
- Configuration
- Directory Structure
- Dockerization
- Gulp - a task automation tool.
- Browsersync - time-saving synchronised browser testing, keep multiple browsers & devices in sync when editing files.
- EditorConfig - a config file for maintaining consistent coding styles.
- svgo - a Node.js module for optimizing SVG vector graphics files.
- svg-sprite - a Node.js module for takes a bunch of SVG files, optimizes them and bakes them into SVG sprites.
- Favicons - a Node.js module for generating favicons and their associated files.
- imagemin - a Node.js module for minify images seamlessly.
- assets-manager - a Node.js module for transfer the required files from your registry distributions to the target.
- Babel - a JavaScript compiler for es5 to es6/7.
- rollup - a module bundler for JavaScript.
- Webpack - a bundler for JavaScript.
- ESLint - the pluggable linting utility for JavaScript and JSX (with preconfigured ruleset by Google.
- UglifyJS – A JavaScript parser, minifier, compressor or beautifier toolkit.
- Sass - CSS with superpowers.
- PostCSS - a tool for transforming styles with JS plugins.
- Autoprefixer - adding vendor prefixes by the rules of Can I Use.
- csso - a CSS minifier with structural optimizations.
- Stylelint - a mighty, modern CSS linter (with preconfigured ruleset by Hugo Giraudel).
- Jekyll - a blog-aware, static site generator in Ruby.
- HTMLHint - a Static Code Analysis Tool for HTML.
- html-minifier - a javascript-based HTML compressor/minifier.
- jekyll-feed - a Jekyll plugin to generate an Atom (RSS-like) feed of your Jekyll posts.
- jekyll-paginate - a Jekyll plugin to generate pagination for your Jekyll posts.
- jekyll-sitemap - a Jekyll plugin to generate a sitemaps.org compliant sitemap.
- rollup-plugin-node-resolve - Use the Node.js resolution algorithm with Rollup.
- rollup-plugin-commonjs - Convert CommonJS modules to ES2015.
- rollup-plugin-uglify - Rollup plugin to minify generated bundle.
- DefinePlugin
- ProvidePlugin
- CommonsChunkPlugin
- NoEmitOnErrorsPlugin
- LoaderOptionsPlugin
- UglifyJsPlugin
- expose-loader
- BannerPlugin
Install NVM. And use the latest version of NodeJS.
nvm install node
nvm use node
Go to sass-lang.com/install for installation in command line.
gem install sass
Before install sass, you should install Ruby and install Gem.
npm install --global yarn
npm install --global babel-cli
npm install --global gulp-cli
Install Jekyll and Bundler gems through RubyGems
gem install jekyll bundler
- Clone this Boilerplate
$ git clone https://github.com/amazingsurge/jekyll-starter-kit.git <PROJECT_NAME>
$ cd <PROJECT_NAME>
- Install Dependencies
$ yarn install
- Install Gem Dependencies
bundler install
- Build the project
$ gulp
- Stay up-to-date
$ git remote add upstream https://github.com/amazingsurge/jekyll-starter-kit.git
$ git pull upstream master
To build, optimize, and distribute to the netlify
branch, run npm run deploy
.
To run separate task type in command line gulp [task_name]
.
Almost all tasks also have watch mode - gulp watch:[task_name]
, but you don't need to use it directly.
Task name | Description |
---|---|
default |
will start all tasks required by project in dev mode: initial build, watch files, run server with livereload |
build |
builds all content and assets from src to dist . |
dev |
builds your project without optimization. |
Task name | Description |
---|---|
styles |
compile all scss from src/styles to dist/assets/styles folder. |
scripts |
compile all js from src/scripts to dist/assets/scripts folder. |
html |
compile all hbs files to html files. |
usemin |
replaces references to non-optimized scripts or stylesheets into a set of HTML files |
Task name | Description |
---|---|
copy |
copy files from src/assets path to dist/assets path. |
vendor |
copy vendor files from registry distributions to dist/assets/vendor path. |
svgs |
optimize svg files. |
sprite |
generate svg sprite. |
fonts |
copy files from src/fonts path to dist/fonts path. |
favicons |
generate favicons to dist/assets/favicons path. |
images |
optimize and copies images in src/images to dist/assets/images . |
Task name | Description |
---|---|
clean |
remove dist folder. |
beautify |
beautify your source files in src/styles and src/scripts . |
server |
start a BrowserSync instance. |
watch |
watchs for changes in src/ path and rebuilds parts of the site as necessary. |
Task name | Description |
---|---|
version:major |
MAJOR version when you make incompatible API changes |
version:minor |
MINOR version when you add functionality in a backwards-compatible manner |
version:patch |
PATCH version when you make backwards-compatible bug fixes. |
version |
alias to version:path . |
All available tasks are placed in a folder tasks
.
gulp [task_name] --prod
orgulp [task_name] --production
to run task in production mode.
Everything's ready to get started right away:
npm start
- Compiles assets & html, launches development server:
- compiles styles & scripts are being compiled & concatenated
- compresses images & svgs
- builds the site & opens it in your default browser
- watches for changes and injects them right away
npm run build
- Same as above, but in production mode:
- compiles & builds everything
- minifies & compresses everything
Global variables and site metadata can be found inside config.js
. Your can make some modification in the file.
The source
directory contains your entire application code, including CSS, JavaScript, HTML.
The rest of the folders and files only exist to make your life easier, and should not need to be touched.
Below you can find full details about significant files and folders.
├── README.md # Readme file
├── package.json # Dependencies for node.js
├── LICENSE # License
├── .babelrc # Babel config file
├── .gitignore # Git ignore rules
├── .htmlhintrc # Settings for HTMLHint
├── postcss.config.js # PostCSS config
├── gulpfile.babel.js # The Gulp task manager configuration
├── /webpack/ # Webpack config
├── /tasks/ # Gulp tasks definitions
├── /archives/ # Folder with zip archives
├── /dist/ # Minified, optimized and compiled files
│ ├── /assets/ # Assets folder
│ │ ├── /styles/ # CSS files
│ │ ├── /scripts/ # JS files
│ │ ├── /fonts/ # Fonts folder
│ │ ├── /images/ # Images folder
│ │ ├── /svgs/ # Svg files
│ │ └── /favicons/ # Favicons files
│ └── *.html # Rendered and compiled HTMLs from hbs
└── /src/ # The source code of the application
├── /assets/ # Static assets files copy to dist
├── /styles/ # Stylesheets source
├── /scripts/ # Javascript source
├── /fonts/ # Font files
├── /images/ # Non compressed image files
├── /svgs/ # Non compressed svg files
├── /favicons/ # Favicon image
- Build and run the Container
$ docker-compose up
- Run a command in a running container
$ docker-compose exec app <COMMAND>
- Remove the old container before creating the new one
$ docker-compose rm -fs
The code is available under the MIT license.