Last active
October 2, 2017 09:50
-
-
Save curiouslychase/7369801 to your computer and use it in GitHub Desktop.
Gist for example bower project blog post.
This file contains 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
{ | |
"directory": "src/_lib", | |
"json": "bower.json" | |
} |
This file contains 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
src | |
dist | |
node_modules |
This file contains 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": "bower_example", | |
"version": "0.0.0", | |
"authors": [ | |
"Chase Adams <[email protected]>" | |
], | |
"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" | |
} | |
} |
This file contains 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
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' | |
]); | |
}; |
This file contains 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": "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" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Blog post: http://www.realchaseadams.com/2013/11/grunt-build-and-bower-package-management/