Skip to content

Instantly share code, notes, and snippets.

@aamnah
Created February 15, 2015 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aamnah/a6dbfd51376393168830 to your computer and use it in GitHub Desktop.
Save aamnah/a6dbfd51376393168830 to your computer and use it in GitHub Desktop.
Grunt snippets for Sublime Text
<!-- Emmet: snippet>description+tabTrigger+content{<![CDATA[ ]]>} -->
<!-- Gruntfile.js -->
<snippet>
<description>Gruntfile.js Skeleton</description>
<tabTrigger>grunt</tabTrigger>
<content><![CDATA[
module.exports = function(grunt) {
// Configure task(s)
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
});
// Load the plugin(s)
grunt.loadNpmTasks( );
// Register task(s)
grunt.registerTask('default', [ ]);
};
]]></content>
</snippet>
<!-- Uglify -->
<snippet>
<description>Minify files with UglifyJS</description>
<tabTrigger>uglify</tabTrigger>
<content><![CDATA[
uglify: {
// Basic compression
my_target: {
files: {
'dest/output.min.js': ['src/input1.js', 'src/input2.js']
}
}
},
]]></content>
</snippet>
<!-- CSSmin -->
<snippet>
<description>Minify CSS</description>
<tabTrigger>cssmin</tabTrigger>
<content><![CDATA[
cssmin: {
// Combine two files into one output file
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'output.css': ['foo.css', 'bar.css']
}
}
},
cssmin: {
// Minify all contents of a release directory and add a .min.css extension
target: {
files: [{
expand: true,
cwd: 'release/css',
src: ['*.css', '!*.min.css'],
dest: 'release/css',
ext: '.min.css'
}]
}
},
]]></content>
</snippet>
<!-- AWS S3 -->
<snippet>
<description>https://github.com/jpillora/grunt-aws</description>
<tabTrigger>s3</tabTrigger>
<content><![CDATA[
aws: grunt.file.readJSON("credentials.json"),
s3: {
// upload all files inside build/ into my-awesome-bucket:
options: {
accessKeyId: "<%= aws.accessKeyId %>",
secretAccessKey: "<%= aws.secretAccessKey %>",
bucket: "my-awesome-bucket"
},
build: {
cwd: "build/",
src: "**"
}
},
]]></content>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment