On Github eouin / evaluation.gruntjs.nodejs.bower
By Edouard Ouin, David Jimenez Calvo, Sinikka Schroter And Steve Ben Ezra
available at https://github.com/eouin/evaluation.gruntjs.nodejs.bower.git
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
It's like a build tool, but different. Build systems have been around for ages.
make, ant, rake, jake, cake, maven, etc.
{ "name": "evaluation.gruntjs.nodejs.bower", "version": "0.0.1", "description": "Introduction to GruntJS, Bower and NodeJS", "author": { "name": "Edouard Ouin", "email": "edouard@ouin.org", "web": "http://www.ouin.org" }, }, "devDependencies": { } }https://npmjs.org/doc/json.html
$ npm install grunt --save-dev
{ "name": "evaluation.gruntjs.nodejs.bower", "version": "0.0.1", "description": "Introduction to GruntJS, Bower and NodeJS", "author": { "name": "Edouard Ouin", "email": "edouard@ouin.org", "web": "http://www.ouin.org" }, }, "devDependencies": { "grunt": "~0.4.0" } }https://npmjs.org/doc/json.html
$ npm install
module.exports = function(grunt) { grunt.initConfig({ uglify: { dist: { src: dist/myfile.js, dest: dist/myfile.min.js }, } }); grunt.loadNpmTasks(grunt-contrib-uglify); grunt.registerTask(default, [uglify]); }
$ npm i grunt-contrib-jshint --save-dev
module.exports = function(grunt) { grunt.initConfig({ jshint: { all: ['*.js'] }, uglify: { dist: { src: dist/myfile.js, dest: dist/myfile.min.js }, } }); grunt.loadNpmTasks(grunt-contrib-uglify); grunt.loadNpmTasks(grunt-contrib-jshint); grunt.registerTask(default, ['jshint', uglify]); }
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jshint: { all: ['* .js'] }, uglify: { options: { banner: '/*! <%= pkg.name %>' + ' <%= grunt.template.today("yyyy-mm-dd") %> */\n' }, dist: { src: 'myfile.js', dest: 'myfile.min.js' } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.registerTask(default, ['jshint', 'uglify']); };
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jshint: { all: ['* .js'] }, uglify: { options: { banner: '/*! <%= pkg.name %>' + ' <%= grunt.template.today("yyyy-mm-dd") %> */\n' }, dist: { src: '<%= pkg.name %>.js', dest: '<%= pkg.name %>.<%= pkg.version %>.min.js' } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.registerTask(default, ['jshint', 'uglify']); };
cssmin: { compress: { options: { banner: '<%= banner %>' }, files: { 'project.min.css': ['1.css', '2.css', ...] } } } grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.registerTask('default', ['jshint', 'uglify', 'cssmin']);
imagemin: { dist: { options: { optimizationLevel: 3 }, files: { // 'destination': 'source' 'dist/img.png': 'src/img.png', 'dist/img.jpg': 'src/img.jpg' } } } grunt.registerTask('default', ['imagemin']);
Bower is a package manager for the web or, more specifically, browser development. Just think npm, but for browser development instead of node development. Bower’s purpose is to manage front-end assets, which can include not just javascript files, but also html, css, image, and font files. Because of this, Bower, unlike npm, can have multiple files (e.g. .js, .css, .html, .png, .ttf) which are considered the main file(s). Bower semantically considers these main files, when packaged together, a component.
npm is most commonly used for Node.js modules, even though a few people use it for front-end packages. Bower is created solely for the front-end and is optimized with that in mind. The biggest difference is that npm does nested dependency tree, which doesn't work that well on the front-end, while Bower requires a flat dependency tree.
You write .scss (Sass files) which then get compiled into normal .css files by a grunt plugin for use by your application.
Structural framework for dynamic applications
var angularLocalStorage = angular.module('LocalStorageModule', []); angularLocalStorage.service('localStorageService', [ '$rootScope', 'prefix', 'cookie', function($rootScope, prefix, cookie) { return ... }]);
https://github.com/grevory/angular-local-storage
$routeProvider.when('/books', { templateUrl: 'books.html', controller: 'BooksCtrl' });
function BooksCtrl($scope) { $scope.books = [ { title: 'The Law', author:'Frederik Bastiat'}, { title: 'Two Treatises of Government', author:'John Locke'}, { title: 'The Communist Manifesto', author:'Karl Marx and Friedrich Engels'} ] }
<ul> <li ng-repeat="book in books"> {{book.title}} written by {{book.author}}. </li> </ul>
function BooksCtrl($scope) { $scope.books = [ { title: 'The Law', author:'Frederik Bastiat'}, { title: 'Two Treatises of Government', author:'John Locke'}, { title: 'The Communist Manifesto', author:'Karl Marx and Friedrich Engels'} ] } <ul> <li ng-repeat="book in books"> {{book.title}} written by {{book.author}}. </li> </ul>
function BooksCtrl($scope, $log) { $scope.books = [ { title: 'The Law', author:'Frederik Bastiat'}, { title: 'Two Treatises of Government', author:'John Locke'}, { title: 'The Communist Manifesto', author:'Karl Marx and Friedrich Engels'} ] $log.info("Books Loaded...") }
<li ng-repeat="book in books"> {{book.title}} written by {{book.author}}. </li>
var app = angular.module("app", []); app.directive("other", function() { return { restrict: "E", template: "<div>Hello World!!!</div>" } }); <div ng-app="something"> <other></other> <div>
var app = angular.module("app", []); app.directive("other", function() { return { restrict: "A", link: function() { alert("Hello World") } } }); <div ng-app="something"> <div other></div> <div>
What follows is taken from:briantford.com/blog/huuuuuge-angular-apps.html By Brian Ford: AngularJS Team Developer
Yeoman is a robust and opinionated client-side stack, comprising tools and frameworks that can help developers quickly build beautiful web applications.
what glues it together
$ yo webapp