All Projects → akikoo → Grunt Frontend Workflow

akikoo / Grunt Frontend Workflow

Licence: mit
Structured, modular and test-driven front-end development and build workflow with Grunt task runner. Includes boilerplate code for Backbone with single/multipage RequireJS setup, and a RESTful API for prototyping.

Projects that are alternatives of or similar to Grunt Frontend Workflow

Fastshell
Fiercely quick front-end boilerplate and workflows, HTML5, Gulp, Sass
Stars: ✭ 563 (+1179.55%)
Mutual labels:  boilerplate, workflow, sass
Primitive
⛏️ ‎ A front-end design toolkit for developing web apps.
Stars: ✭ 783 (+1679.55%)
Mutual labels:  boilerplate, workflow, sass
Frontie Webpack
Front-end Boilerplate | Gulp 4 + Webpack 4 + Babel + ITCSS Architecture + BEM Methodology + Twig.js
Stars: ✭ 102 (+131.82%)
Mutual labels:  boilerplate, workflow, sass
React Webpack Typescript Starter
Minimal starter with hot module replacement (HMR) for rapid development.
Stars: ✭ 632 (+1336.36%)
Mutual labels:  boilerplate, sass
Laravel Vue Boilerplate
🐘 A Laravel 6 SPA boilerplate with a users CRUD using Vue.js 2.6, GraphQL, Bootstrap 4, TypeScript, Sass, and Pug.
Stars: ✭ 472 (+972.73%)
Mutual labels:  boilerplate, sass
Redux Webpack Es6 Boilerplate
A starter project for modern React apps with Redux
Stars: ✭ 566 (+1186.36%)
Mutual labels:  boilerplate, sass
Almace Scaffolding
AMSF, a.k.a. Almace Scaffolding, a super-fast Jekyll framework fighting against the website obesity.
Stars: ✭ 275 (+525%)
Mutual labels:  grunt, sass
Sassy Starter
🎉 Sassy starter - HTML / SCSS (SMACSS)
Stars: ✭ 740 (+1581.82%)
Mutual labels:  boilerplate, sass
Wordpress Gulp Starter Kit
[NOT MAINTAINED] A starter kit for developing WordPress themes with Gulp.
Stars: ✭ 674 (+1431.82%)
Mutual labels:  workflow, sass
Instantbootstrap
Instant Bootstrap is a quick and easy way to start creating bootstrap themes using LESS, SASS, GRUNT, and BOWER.
Stars: ✭ 5 (-88.64%)
Mutual labels:  grunt, sass
Gulp Boilerplate
A boilerplate for building web projects with Gulp.js.
Stars: ✭ 840 (+1809.09%)
Mutual labels:  boilerplate, sass
Webpack Boilerplate
A minimal webpack 5 boilerplate with only Babel, SASS and lodash (optional) on board
Stars: ✭ 404 (+818.18%)
Mutual labels:  boilerplate, sass
Motherplate
A bare bones responsive SCSS boilerplate for web designers
Stars: ✭ 392 (+790.91%)
Mutual labels:  boilerplate, sass
Kratos Boilerplate
🔥 A simple boilerplate for creating statics PWA using Webpack, Pug, PostCSS and CSS Modules
Stars: ✭ 308 (+600%)
Mutual labels:  boilerplate, sass
Next Boilerplate
A well-structured production ready Next.js boilerplate with Typescript, Redux, Jest, Enzyme, Express.js, Sass, Css, EnvConfig, Fetch, Reverse Proxy, Bundle Analyzer and Built-in Project CLI. https://pankod.github.io/next-boilerplate/
Stars: ✭ 936 (+2027.27%)
Mutual labels:  boilerplate, sass
Hive Framework
A website development framework built with Sass, and incorporating jQuery UI.
Stars: ✭ 14 (-68.18%)
Mutual labels:  grunt, sass
Web Extension Starter
🖥🔋Web Extension starter to build "Write Once Run on Any Browser" extension
Stars: ✭ 987 (+2143.18%)
Mutual labels:  boilerplate, sass
Modular Admin Html
ModularAdmin - Free Dashboard Theme Built On Bootstrap 4 | HTML Version
Stars: ✭ 2,875 (+6434.09%)
Mutual labels:  boilerplate, sass
Threejs Webpack Es6 Boilerplate
A basic boilerplate for a Three.js project compiled with Webpack and transpiled via Babel to enable using ES6 syntax.
Stars: ✭ 267 (+506.82%)
Mutual labels:  boilerplate, sass
Html boilerplate
Ceicom Boilerplate
Stars: ✭ 6 (-86.36%)
Mutual labels:  requirejs, boilerplate

Grunt Front-End Workflow/Boilerplate

What is it?

The Grunt Front-End Workflow/Boilerplate started as Backbone/RequireJS Multipage Boilerplate. Since its initial release, it has evolved into a structured, modular and test-driven front-end development & build workflow with Grunt task runner. It suggests certain tools and methodologies and includes some boilerplate code. See the related blog post: http://www.akikoo.org/log/2013/05/26/front-end-workflow-with-grunt/.

It supports both SPAs (single page applications) and more traditional multi-page setups, managing dependencies with RequireJS (http://requirejs.org/).

For stylesheets, have a look at One Web Boilerplate (http://akikoo.github.io/one-web-boilerplate/) that uses Sass preprocessor (http://sass-lang.com/) and Compass (http://compass-style.org/), with SMACSS (Scalable and Modular Architecture for CSS, http://smacss.com/) and some OOCSS (Object-Oriented CSS, http://oocss.org/). You can just drop the whole /webroot/assets/scss directory from One Web Boilerplate into /www directory in Grunt Front-End Workflow and it will work, with only one small path change in /scss/common/_base.scss:

Change line @import "../../assets/css/common/normalize.css"; to this: @import "common/normalize.css";

The goal of this workflow is to support modularity and code reuse by organizing code into both common and page-specific packages. RequireJS setup is adapted from https://github.com/requirejs/example-multipage-shim.

Grunt is used for running specified tasks during development. It's also used for creating builds.

###Currently the following common tasks are included:

  • Compile modular html patterns (you can use variables and pass in data too),
  • Compile AMD based modules using RequireJS,
  • Watch/compile Sass/Compass modules into CSS,
  • Watch/lint CSS/JS code,
  • Optimize images,
  • Generate sharp vector icons to all devices,
  • Generate dynamic build headers
  • Generate YUIdoc documentation, and
  • Run unit tests in different browsers.

##Environment setup

You'll need the following tools to get the full advantages of this workflow:

###Ruby On OS X, you'll already have Ruby installed. On Windows, see http://rubyinstaller.org/downloads/.

###Sass and Compass

Make sure you have Ruby installed before this step.

Install Sass: http://sass-lang.com/tutorial.html.

Install Compass: http://compass-style.org/install/.

###Node.js Install Node.js with npm (package manager for Node): http://nodejs.org/.

###Bower

Install Bower front-end package manager (http://bower.io/).

npm install -g bower

Bower currently has some issues on Windows so you might want to skip the next step. Packages that Bower installs are already included in this repository.

However if Bower works in your environment you'll probably want to manage your front-end library packages with it. To do so (after installing bower globally), go to the project folder and install/update packages using the dependencies listed in the current directory's bower.json.

bower install

###MongoDB

By default, Express application framework and MongoDB are used for persisting models with REST API. For installing MongoDB, see http://docs.mongodb.org/manual/installation/. If you're on OS X, see http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/.

In this project there's also a PHP REST API in /api directory (using Slim framework), and a MySQL database dump itemdb.sql if you want to use those for prototyping. I've recently switched to using the Express RESTful server and MongoDB instead.

Be sure to check the links above, to install the correct MongoDB version for your environment. On OS X, this worked for me using the terminal:

## Go to temp folder
cd Downloads/

## Download MongoDB
curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.6.tgz > mongodb.tgz

## Extract it
tar -zxvf mongodb.tgz

## Move to generic location
mv -n mongodb-osx-x86_64-2.4.6/ /usr/local/mongodb

## Create data dir and fix permissions
sudo mkdir -p /data/db
sudo chown `id -u` /data/db

## Assign $PATH environment variables in .profile or .bash_profile
export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin

## Try it
mongo -version

## Start the mongod process
mongod

## Open the mongo shell (in second terminal tab/window)
mongo

If you don't need a local RESTful API or database, or if you use other service, comment out this line in Gruntfile.js (line number 76):

// server: path.resolve('./server.js'),

Remember also to adapt the service URL in /www/js/app/collections/items.js if necessary.

###Grunt See http://gruntjs.com/getting-started.

npm uninstall -g grunt
npm install -g grunt-cli

After installing grunt-cli (Grunt's command line interface) globally, go to the project folder and install all the dependencies listed in package.json. This will install a local version of Grunt as well.

npm install

That's it.

##Development

To start developing, go to the project folder in your terminal and run

grunt

Note that if you installed MongoDB as mentioned above, you need to start the service by first starting the mongod process in terminal:

mongod

Then, open the mongo shell:

mongo

Then go to http://localhost:9001/ to view your site. You can also access your local site from another device on the same LAN by using your IP address instead of localhost, for example http://10.0.0.32:9001/. Files are being observed for changes using livereload so you don't need to refresh the page manually. Stylesheets are generated from Sass files, and CSS and JavaScript files are linted.

##Build

To trigger the optimized build, go to the project folder and run

grunt dist

This will run all the tasks again and copy the optimized files to webroot-built directory, ready for deployment. You also get YUIDoc documentation generated from your JavaScript files so remember to always comment your code ;).

For details about all the tasks and processes, see documentation in Gruntfile: https://github.com/akikoo/grunt-frontend-workflow/blob/master/Gruntfile.js, and other files.

Be sure to exclude .sass-cache, node_modules and webroot-built directories from version control. You should probably exclude /www/js/lib as well because third-party libraries are managed locally by Bower.

I hope this framework is as useful to you as it is for me. Have fun!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].