Giter VIP home page Giter VIP logo

frontend-boilerplate's Introduction

Architect Front-end Boilerplate

A starting point for Architect front-end projects.

Installation:

  • Download and unzip into project directory wget https://github.com/wearearchitect/Frontend-Boilerplate/archive/master.zip
  • run npm install
  • run bundle install
  • Away you go…

Gulp

The standard build tool we’re now using is Gulp with the following plugins:

  • gulp-autoprefixer
  • gulp-cheerio
  • gulp-concat
  • gulp-if
  • gulp-inject
  • gulp-load-plugins
  • gulp-minify-css
  • gulp-plumber
  • gulp-rename
  • gulp-ruby-sass
  • gulp-size
  • gulp-svg-sprite
  • gulp-uglify

Additional plugins on dev:

  • browser-sync
  • gulp-cache
  • gulp-imagemin
  • gulp-notify
  • gulp-scss-lint
  • gulp-jshint

In the gulpfile, plugins are loaded with gulp-load-plugins so should be used with the $. prefix.

Tasks:

  • gulp dev - task to run during development
  • gulp lint - task to lint Sass code (should be run often - code should pass lint tests before a PR is accepted)
  • gulp - runs all tasks (use in dev)
  • gulp --production - runs all production tasks (i.e excludes devDependencies )

The SVG Icon System

Run the gulp svg task to create your SVG icon block.

SVG files added to assets/img/svg will be optimised and added to an icons.svg file (this is also created by the gulp svg task). Having run the task, you'll also now find a handy Icons Preview - a generated HTML page that allows you to see your freshly compressed SVGs alongside the SVG syntax needed to display the icons on your site (see below). Each icon's class will be icon- + filename.

The task also injects the symbols block into the head of your document inbetween the <!-- inject:svg --> and <!-- endinject --> (this should always be placed after the opening <body> tag more than likely in your header.php). You're then free to use your icons like this:

<svg class="icon-twitter">
	<use xlink:href="#twitter"></use>
</svg>

They can then be styled with all the CSS you desire.

NB: Browser support is solid and this system will work in IE9 and up. Critical icons needed to display in IE8 can be intiated with the SVG For Everybody polyfill.

Further reading:

Structure

The main directory is assets that contains all the styles, scripts, and images used to create the front-end. The assets directory structure is:

assets/
|- img/           # use appropriate sub-folders
|- js/
|  |- vendor/
|  `- src/
|     `- core.js
`- scss/
|  |- base/
|  |- components/
|  |- pages/
|  |- patterns/
|  |- sections/
|  |- settings/
|  |- tools/
|  |- vendor/
   |- print.scss
   |- ie.scss     # IE stylesheet based on main.scss
   `- main.scss   # Main manifest file

Files are by default output to the public directory in the following folder structure:

public/
|- img/     # matches assets directory structure
|- _js/
|- _css/

However the output directories can be changed based on the specific project using the paths object at the top of the gruntfile:

paths = {
	scss: 'assets/scss/*.scss',
	js: 'assets/js/*.js',
	img: 'assets/img/*'
}

Sass structure

The base structure of the Sass directory should remain, whether being used or not.

NOTE: Rendering and non-rendering Sass should remain separate, see this post for more information: https://robots.thoughtbot.com/separate-rendering-sass-from-non-rendering-sass

Non-rendering Sass should be placed in the following folders:

  • tools
  • settings
  • patterns

Rendering Sass should go in the remaining folders:

  • base
  • components
  • pages
  • sections
  • vendor

Sub-folders

The use of sub-folders is encouraged to further break down related files.

In JavaScript a sub-folder of modules inside of the src folder would be good practice to break down any smaller functionality that is used by the files in the src folder.

In Sass, sub-folders are encouraged to keep partial size down and keep related styles together. When creating a sub-folder within one of the main Sass folders, also create a manifest partial of the same name to include the partials contained within. For example, in the following file structure:

components/
|- forms/
   |- _select.scss
   |- _radio.scss
   |- _checkbox.scss
|- _forms.scss

The _forms.scss partial, should contain the manifest for the forms folder:

@import 'forms/select';
@import 'forms/radio';
@import 'forms/checkbox';

License

GPL2

frontend-boilerplate's People

Contributors

mrrossbennett avatar onishiweb avatar tedslittlerobot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.