Getting all the right tools to work together is no easy task. Even harder to get them to work automatically. Pressing refresh for every one of your changes, be it for CSS or a blog edit, is also a hassle. When you just want to publish content or just change a color, you don’t want to spend time firing up a web server, starting the IDE, opening your browser and finding the right URL. This automated setup will do all of that for you just by opening your project. Designers and blog writers alike would make good use of this set up. For designers, there is SASS, auto vender prefixes, mixin library with a grid layout. For bloggers, simple date filename layout, with your choice of several markdown languages. Also, blog posts automatically populated with links when Jekyll compiles automatically with Gulp. These instructions will work for Linux, Unix, and OS X.
Features:
- Fast and simple development
- No database or web server for development
- Markdown blog syntax
- Blog-aware
- Single compiled CSS file
- HTML / SASS changes update browser automatically
- Opening the project in PhpStorm launches all build processes and browser
- Automatically add vendor prefixes to CSS rules using values from Can I Use
Tools you’ll need
PhpStorm 2016.x https://www.jetbrains.com/phpstorm/
Jekyll 3.1.6 https://jekyllrb.com/
SASS 3.4.22 http://sass-lang.com/ https://github.com/sass/sass
Node.js https://nodejs.org/en/
NPM https://www.npmjs.com/
Node Js Modules
Gulp http://gulpjs.com/ Automate and enhance your workflow
Normalize SCSS https://github.com/JohnAlbin/normalize-scss , a collection of HTML element and attribute rulesets to normalize styles across all browsers
Bourbon http://bourbon.io/ a lightweight mixin library
Bourbon Neat http://neat.bourbon.io/ a mixin-based grid layout system
Browsersync https://www.browsersync.io/ a time-saving synchronised browser testing
Autoprefixer https://github.com/postcss/autoprefixer plugin to add vendor prefixes to CSS rules using values from Can I Use
- Download and install 30-day trial of PhpStorm https://www.jetbrains.com/phpstorm/download/
- Download and install current version of Node.js https://nodejs.org/en/
- ~ $
sudo npm install npm -g
- Download and install Jekyll requirements https://jekyllrb.com/docs/installation/
- ~ $
sudo gem install jekyll -v 3.1.6
or for 10.11sudo gem install -n /usr/local/bin jekyll -v 3.1.6
Creating new Sites
- ~ $
jekyll new {path to project}
i.e. jekyll new my-blog - ~ $
cd {path to project}
i.e. cd my-blog - ~ $
npm install -S gulp
- ~ $
npm install -S gulp-sass
- ~ $
npm install -S browser-sync
- ~ $
npm install -S normalize-scss
- ~ $
npm install -S bourbon
- ~ $
npm install -S bourbon-neat
- ~ $
npm install -S gulp-autoprefixer
- Download https://github.com/BernardRobbins/jekyll-gulp-sass-browser-sync/blob/master/gulpfile.js into {path to project}. Now, click the “Raw” button and “save as” from browser to {path to project}.
- Changes need to be made to {path to project}/css/main.scss file.
- Remove
---
comment block - Add
@import "normalize/import-now", "bourbon", "neat";
under@charset "utf-8";
- Remove
- Add
exclude: ["node_modules", "gulpfile.js", "package.json", "css/main.scss"]
to {path to project}/_config.yml - PhpStorm -> Create New Project from Existing Files -> Source files are in a local directory, no Web server is yet configured -> {path to project} -> click Project Root -> click Finish.
- PhpStorm -> Settings -> Tools -> Startup Tasks -> + Add New Configuration -> Gulp.js
Name: Jekyll
Gulpfile: {path to project}/gulpfile.js (should be pre-filled)
Gulp package: {path to project}/node_modules/gulp (should be pre-filled) - PhpStorm -> Run -> Run… -> Jekyll
You should now see a browser window that has opened showing the default Jekyll site.
_config.yml Jekyll options are listed on https://jekyllrb.com/docs/configuration/