Skip to content

Commit

Permalink
install bower_components in root directory
Browse files Browse the repository at this point in the history
/app should only have user created/editable files. Bower should install
its files alongside npm's.

Fixes #171
  • Loading branch information
eddiemonge authored and silvenon committed Mar 20, 2014
1 parent 8d67fee commit cdc519d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
59 changes: 37 additions & 22 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ module.exports = function (grunt) {
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);

// Configurable paths
var config = {
app: 'app',
dist: 'dist'
};

// Define the configuration for all the tasks
grunt.initConfig({

// Project settings
config: {
// Configurable paths
app: 'app',
dist: 'dist'
},
config: config,

// Watches files for changes and runs tasks based on the changed files
watch: {
Expand Down Expand Up @@ -78,32 +80,38 @@ module.exports = function (grunt) {
connect: {
options: {
port: 9000,
open: true,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%%= config.app %>'
]
middleware: function(connect) {
return [
connect.static('.tmp'),
connect().use('/bower_components', connect.static('./bower_components')),
connect.static(config.app)
]
}
}
},
test: {
options: {
open: false,
port: 9001,
base: [
'.tmp',
'test',
'<%%= config.app %>'
]
middleware: function(connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use('/bower_components', connect.static('./bower_components')),
connect.static(config.app)
]
}
}
},
dist: {
options: {
open: true,
base: '<%%= config.dist %>',
livereload: false
}
Expand Down Expand Up @@ -189,7 +197,7 @@ module.exports = function (grunt) {
imagesDir: '<%%= config.app %>/images',
javascriptsDir: '<%%= config.app %>/scripts',
fontsDir: '<%%= config.app %>/styles/fonts',
importPath: '<%%= config.app %>/bower_components',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
Expand Down Expand Up @@ -228,7 +236,7 @@ module.exports = function (grunt) {
app: {
src: ['<%%= config.app %>/index.html'],
ignorePath: '<%%= config.app %>/'<% if (includeCompass) { %>,
exclude: ['<%%= config.app %>/bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js']
exclude: ['./bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js']
},
sass: {
src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
Expand Down Expand Up @@ -354,11 +362,18 @@ module.exports = function (grunt) {
'.htaccess',
'images/{,*/}*.webp',
'{,*/}*.html',
'styles/fonts/{,*/}*.*'<% if (includeBootstrap) { %>,<% if (includeCompass) { %>
'styles/fonts/{,*/}*.*'
]
}<% if (includeBootstrap) { %>, {
expand: true,
dot: true,
cwd: '.',
dest: '<%%= config.dist %>',
src: [<% if (includeCompass) { %>
'bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/*.*'<% } else { %>
'bower_components/bootstrap/dist/fonts/*.*'<% } %><% } %>
'bower_components/bootstrap/dist/fonts/*.*'<% } %>
]
}]
}<% } %>]
},
styles: {
expand: true,
Expand All @@ -372,7 +387,7 @@ module.exports = function (grunt) {
// Generates a custom Modernizr build that includes only the tests you
// reference in your app
modernizr: {
devFile: '<%%= config.app %>/bower_components/modernizr/modernizr.js',
devFile: './bower_components/modernizr/modernizr.js',
outputFile: '<%%= config.dist %>/scripts/vendor/modernizr.js',
files: [
'<%%= config.dist %>/scripts/{,*/}*.js',
Expand Down
2 changes: 1 addition & 1 deletion app/templates/bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory": "app/bower_components"
"directory": "bower_components"
}
2 changes: 1 addition & 1 deletion app/templates/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ node_modules
dist
.tmp
.sass-cache
app/bower_components
bower_components
test/bower_components

0 comments on commit cdc519d

Please sign in to comment.