Skip to content

Commit

Permalink
Improved a lot of stuff and simplified the output view generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPietrusky committed Dec 22, 2013
1 parent 8bffca0 commit aac8600
Show file tree
Hide file tree
Showing 17 changed files with 1,200 additions and 5,927 deletions.
181 changes: 142 additions & 39 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ module.exports = function (grunt) {
js: [
'<%= project.src %>/js/vendor/libs.js',
'<%= project.src %>/js/vendor/ga.js',
'<%= project.src %>/js/core/*.js',
'<%= project.src %>/js/core/iconfonts.js',
'<%= project.src %>/js/core/main.js',
'<%= project.src %>/js/*.js'
]
},
Expand Down Expand Up @@ -104,6 +105,57 @@ module.exports = function (grunt) {



/**
* Opens the web server in the browser
* https://github.com/jsoverson/grunt-open
*/
open: {
server: {
path: 'http://weloveiconfonts.local'
}
},





/**
* Runs tasks against changed watched files
* https://github.com/gruntjs/grunt-contrib-watch
* Watching development files and run concat/compile tasks
* Livereload the browser once complete
*/
watch: {
js: {
files: '<%= project.src %>/js/{,*/}*.js',
tasks: ['concat:dev', 'jshint']
},

html: {
files: [
'<%= project.src %>/{,*/}*.html',
],
tasks: ['copy']
},

// The name of the subtask of watch
livereload: {
options: {
livereload: LIVERELOAD_PORT
},
files: [
'<%= project.src %>/{,*/}*.html',
'<%= project.skin %>/css/*.css',
'<%= project.skin %>/js/{,*/}*.js',
'<%= project.skin %>/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},





/**
* JSHint
* https://github.com/gruntjs/grunt-contrib-jshint
Expand Down Expand Up @@ -168,11 +220,21 @@ module.exports = function (grunt) {
* Compiles all Sass/SCSS files and appends project banner
*/
compass: {
once: {
options: {
sassDir: '<%= project.src %>/scss',
cssDir: '<%= project.skin %>/css',
outputStyle: 'compressed',
environment: 'production'
}
},
dev: {
options: {
sassDir: '<%= project.src %>/scss',
cssDir: '<%= project.skin %>/css',
watch: true
watch: true,
outputStyle: 'compressed',
environment: 'production'
}
},
dist: {
Expand All @@ -189,53 +251,40 @@ module.exports = function (grunt) {



/**
* Opens the web server in the browser
* https://github.com/jsoverson/grunt-open
/*
* We use "compass watch" and "watch" at the same time
*/
open: {
server: {
path: 'http://weloveiconfonts.local'
}
concurrent: {
target1: ['compass', 'watch']
},





/**
* Runs tasks against changed watched files
* https://github.com/gruntjs/grunt-contrib-watch
* Watching development files and run concat/compile tasks
* Livereload the browser once complete
*/
watch: {
concat: {
files: '<%= project.src %>/js/{,*/}*.js',
tasks: ['concat:dev', 'jshint']
},
livereload: {
options: {
livereload: LIVERELOAD_PORT
},
files: [
'<%= project.app %>/{,*/}*.html',
'<%= project.skin %>/css/*.css',
'<%= project.skin %>/js/{,*/}*.js',
'<%= project.skin %>/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
clean: [
'<%= project.skin %>/css/*.css',
'<%= project.skin %>/js/*.js'
],





/*
* We use "compass watch" and "watch" at the same time
/*
* Copy folder/files from src to dest
*
* https://github.com/gruntjs/grunt-contrib-copy
*/
concurrent: {
target1: ['compass', 'watch']
copy: {
main: {
expand: true,
flatten: true,
filter: 'isFile',
cwd: '<%= project.src %>',
src: 'index.html',
dest: '<%= project.app %>/'
}
},


Expand Down Expand Up @@ -264,6 +313,8 @@ module.exports = function (grunt) {

/*
* Deploy to a server with SFTP
*
* https://github.com/thrashr888/grunt-sftp-deploy
*/
'sftp-deploy': {
build: {
Expand All @@ -274,10 +325,56 @@ module.exports = function (grunt) {
},
src: 'app',
dest: '/var/www/weloveiconfonts.com',
exclusions: ['app/.gitignore'],
exclusions: [
'<%= project.app %>/.gitignore',
'<%= project.app %>/api'
],
server_sep: '/'
}
},






hashres: {
// Global options
options: {
// Optional. Encoding used to read/write files. Default value 'utf8'
encoding: 'utf8',
// Optional. Format used to name the files specified in 'files' property.
// Default value: '${hash}.${name}.cache.${ext}'
fileNameFormat: '${hash}.${name}.${ext}',
// Optional. Should files be renamed or only alter tshe references to the files
// Use it with '${name}.${ext}?${hash} to get perfect caching without renaming your files
// Default value: true
renameFiles: true
},

prod: {
// Specific options, override the global ones
options: {
// You can override encoding, fileNameFormat or renameFiles
},
// Files to hash
src: [
// WARNING: These files will be renamed!
'<%= project.skin %>/js/scripts.min.js',
'<%= project.skin %>/css/style.css'],
// File that refers to above files and needs to be updated with the hashed name
dest: '<%= project.app %>/index.html',
}
},









});


Expand All @@ -289,6 +386,10 @@ module.exports = function (grunt) {
* Run `grunt` on the command line
*/
grunt.registerTask('default', [
'copy',
'clean',
'concat:dev',
'compass:once',
'jshint',
'connect:livereload',
'open',
Expand All @@ -305,10 +406,12 @@ module.exports = function (grunt) {
* Then compress all JS/CSS files
*/
grunt.registerTask('build', [
'clean',
'compass:dist',
'jshint',
'uglify',
'copy',
'hashres',
'sftp-deploy'
]);

};
};
2 changes: 1 addition & 1 deletion app/index.html
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h2>zocial</h2>
<article id="output" data-high="5">
<section data-cols="1">
<div>
<h2>Use selected fonts</h2>
<h2>Use selected font(s)</h2>
</div>
</section>

Expand Down
Loading

0 comments on commit aac8600

Please sign in to comment.