Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gist for example bower project blog post.
{
"directory": "src/_lib",
"json": "bower.json"
}
src
dist
node_modules
{
"name": "bower_example",
"version": "0.0.0",
"authors": [
"Chase Adams <chase@realchaseadams.com>"
],
"description": "An example of how to use bower",
"license": "MIT",
"homepage": "http://www.realchaseadams.com",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"src/_lib",
"test",
"tests"
],
"dependencies": {
"underscore": "~1.5.2",
"jquery": "~2.0.3",
"font-awesome": "~4.0.3",
"requirejs": "~2.1.9"
}
}
var pkgjson = require('./package.json');
var config = {
pkg: pkgjson,
app: 'src',
dist: 'dist'
}
module.exports = function (grunt) {
// Configuration
grunt.initConfig({
config: config,
pkg: config.pkg,
bower: grunt.file.readJSON('./.bowerrc'),
copy: {
dist: {
files: [{
expand: true,
cwd: '<%= config.app %>/_lib/font-awesome',
src: 'css/font-awesome.min.css',
dest: '<%= config.dist %>'
},
{
expand: true,
cwd: '<%= config.app %>/_lib/font-awesome',
src: 'fonts/*',
dest: '<%= config.dist %>'
}]
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> lib - v<%= pkg.version %> -' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
dist: {
files: {
'<%= config.dist %>/js/lib.min.js': [
'<%= bower.directory %>/jquery/jquery.js',
'<%= bower.directory %>/underscore/underscore.js',
'<%= bower.directory %>/requirejs/require.js',
]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', [
'copy',
'uglify'
]);
};
{
"name": "bower_example",
"version": "0.0.0",
"description": "An example of a bower project",
"main": "Gruntfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gist.github.com/7369801.git"
},
"author": "Chase Adams",
"license": "BSD",
"bugs": {
"url": "https://gist.github.com/7369801"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-uglify": "~0.2.5"
}
}
@mchelen

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment