Skip to content

Instantly share code, notes, and snippets.

@jimmyandrade
Created December 7, 2015 16:43
Show Gist options
  • Save jimmyandrade/d03447e173f39a977bb6 to your computer and use it in GitHub Desktop.
Save jimmyandrade/d03447e173f39a977bb6 to your computer and use it in GitHub Desktop.
Essential Gruntfile.js and NPM Dependencies
# Bower
bower_components/
# Node
node_modules/
# Dist
dist/
src/css
src/js
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
*.scssc
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '\n',
stripBanners: true,
sourceMap: false,
banner: ''
},
dist: {
src: [
'bower_components/jquery/dist/jquery.min.js',
'src/js/app.min.js'
],
dest: 'dist/app.js'
}
},
cssmin: {
options: {
shorthandCompacting: true
},
target: {
files: {
'dist/app.css': ['src/css/app.css']
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'dist/index.html': 'src/index.html'
}
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'src/images/',
src: ['**/*.{png,jpg,gif}'],
dest: 'dist/images/'
}]
}
},
jshint: {
files: ['Gruntfile.js', 'src/js/app.js'],
options: {
}
},
sass: {
dist: {
options: {
},
files: {
'src/css/app.css': 'src/sass/app.scss'
}
}
},
ts: {
default: {
src: ['src/ts/*.ts'],
dest: ['src/js/app.js']
},
options: {
comments: false,
compile: true,
fast: 'never'
}
},
uglify: {
target: {
files: {
'src/js/app.min.js': ['src/js/app.js']
}
}
},
watch: {
gruntfile: {
files: 'Gruntfile.js',
tasks: ['jshint']
},
images: {
files: 'src/images/*',
tasks: ['imagemin']
},
html: {
files: 'src/*.html',
tasks: ['htmlmin']
},
css: {
files: 'src/sass/*.scss',
tasks: ['sass', 'cssmin']
},
js: {
files: '<%= ts.default.src %>',
tasks: ['ts', 'jshint', 'uglify', 'concat']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['htmlmin', 'sass', 'cssmin', 'ts', 'jshint', 'uglify', 'concat']);
};
{
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-htmlmin": "^0.6.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-uglify": "^0.11.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-ts": "^5.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment