Created
October 15, 2013 09:32
Sample minimal grunt+angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global module:false*/ | |
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
// Metadata. | |
pkg: grunt.file.readJSON('package.json'), | |
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + | |
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + | |
'* Copyright (c) <%= grunt.template.today("yyyy") %>;' + | |
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', | |
config: { | |
dist:'./dist', | |
src: './src', | |
js: '<%= config.src %>/js/**/*.js', | |
}, | |
clean: ['<%= config.dist %>'], | |
copy: { | |
index: { | |
src: '<%= config.src %>/index.html', | |
dest: '<%= config.dist %>/index.html', | |
} | |
}, | |
// Task configuration. | |
concat: { | |
options: { | |
banner: '<%= banner %>', | |
stripBanners: true | |
}, | |
dist: { | |
src: ['<%= config.src %>/js/<%= pkg.name %>.js', '<%= config.js %>'], | |
dest: '<%= config.dist %>/<%= pkg.name %>.js' | |
} | |
}, | |
uglify: { | |
options: { | |
banner: '<%= banner %>' | |
}, | |
dist: { | |
src: '<%= concat.dist.dest %>', | |
dest: '<%= config.dist %>/<%= pkg.name %>.min.js' | |
} | |
}, | |
jshint: { | |
options: { | |
curly: true, | |
eqeqeq: true, | |
immed: true, | |
latedef: true, | |
newcap: true, | |
noarg: true, | |
sub: true, | |
undef: true, | |
unused: true, | |
boss: true, | |
eqnull: true, | |
browser: true, | |
globals: { | |
angular: true | |
} | |
}, | |
gruntfile: { | |
src: 'Gruntfile.js' | |
} | |
}, | |
sass: { | |
dev: { | |
//files: [{ | |
src: '<%= config.src %>/scss/styles.scss', | |
dest:'<%= config.dist %>/styles.css' | |
//}] | |
} | |
}, | |
autoprefixer: { | |
dev: { | |
options: { | |
browsers: ['last 2 versions'] | |
}, | |
src: '<%= sass.dev.dest %>', | |
dest: '<%= sass.dev.dest %>' | |
} | |
}, | |
delta: { | |
gruntfile: { | |
files: '<%= jshint.gruntfile.src %>', | |
tasks: ['build'] | |
}, | |
js: { | |
files: '<%= config.js %>', | |
tasks: ['build'] | |
}, | |
scss: { | |
files: '<%= config.src %>/scss/**/*.scss', | |
tasks: ['sass', 'autoprefixer'] | |
}, | |
index: { | |
files: '<%= config.src %>/index.html', | |
tasks: ['build'] | |
} | |
}, | |
connect: { | |
server: { | |
options: { | |
port: 9393, | |
hostname: '0.0.0.0', | |
base: 'dist' | |
} | |
} | |
} | |
}); | |
// These plugins provide necessary tasks. | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks('grunt-contrib-connect'); | |
grunt.loadNpmTasks('grunt-autoprefixer'); | |
grunt.registerTask('build', ['clean', 'copy', 'jshint', 'concat', 'uglify', 'sass', 'autoprefixer']); | |
grunt.renameTask( 'watch', 'delta' ); | |
grunt.registerTask('watch', ['connect', 'delta']); | |
grunt.registerTask('default', ['watch']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="App"> | |
<head> | |
<link href='http://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'> | |
<meta name=viewport content=width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1> | |
<meta name="apple-mobile-web-app-title" content="App"> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | |
<link rel="stylesheet" type="text/css" href="styles.css"> | |
<style> | |
.ng-cloak {display:none;} | |
</style> | |
</head> | |
<body> | |
<script src="//code.angularjs.org/1.1.5/angular.js"></script> | |
<script language="javascript" src="app.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "AppName", | |
"version": "0.0.0-ignored", | |
"engines": { | |
"node": ">= 0.8.0" | |
}, | |
"scripts": { | |
"test": "grunt qunit" | |
}, | |
"devDependencies": { | |
"grunt-contrib-jshint": "~0.6.0", | |
"grunt-contrib-concat": "~0.3.0", | |
"grunt-contrib-uglify": "~0.2.0", | |
"grunt-contrib-watch": "~0.4.0", | |
"grunt-contrib-clean": "~0.5.0", | |
"grunt": "~0.4.1", | |
"grunt-contrib-compass": "~0.6.0", | |
"grunt-contrib-sass": "~0.5.0", | |
"grunt-contrib-copy": "~0.4.1", | |
"grunt-autoprefixer": "~0.3.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment