Skip to content

Commit

Permalink
feat(app): move bower_components to root folder
Browse files Browse the repository at this point in the history
This change mirrors generator-webapps moving bower_components to the
root of the project.

BREAKING CHANGE: bower_components is now in the /project_root directory
  • Loading branch information
eddiemonge committed Jun 5, 2014
1 parent f27566d commit 396a2c0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 27 deletions.
5 changes: 1 addition & 4 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ var Generator = module.exports = function Generator(args, options) {
'test/mock/**/*.' + jsExt,
'test/spec/**/*.' + jsExt
].join(','),
'bower-components-path': path.join(
this.options.appPath, 'bower_components'
)
'bower-components-path': 'bower_components'
}
});

Expand Down Expand Up @@ -312,7 +310,6 @@ Generator.prototype.packageFiles = function packageFiles() {
this.coffee = this.env.options.coffee;
this.template('root/_bower.json', 'bower.json');
this.template('root/_bowerrc', '.bowerrc');
this.template('root/gitignore', '.gitignore');
this.template('root/_package.json', 'package.json');
this.template('root/_Gruntfile.js', 'Gruntfile.js');
};
Expand Down
1 change: 1 addition & 0 deletions common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Generator.prototype.setupEnv = function setupEnv() {
this.copy('.editorconfig');
this.copy('.gitattributes');
this.copy('.jshintrc');
this.copy('gitignore', '.gitignore');
this.directory('test');

this.sourceRoot(join(__dirname, '../templates/common'));
Expand Down
57 changes: 36 additions & 21 deletions templates/common/root/_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 for the application
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'dist'
};

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

// Project settings
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'app',
dist: 'dist'
},
yeoman: appConfig,

// Watches files for changes and runs tasks based on the changed files
watch: {
Expand Down Expand Up @@ -85,20 +87,32 @@ module.exports = function (grunt) {
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%%= yeoman.app %>'
]
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
base: [
'.tmp',
'test',
'<%%= yeoman.app %>'
]
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},
dist: {
Expand Down Expand Up @@ -163,11 +177,11 @@ module.exports = function (grunt) {
wiredep: {
app: {
src: ['<%%= yeoman.app %>/index.html'],
ignorePath: new RegExp('^<%%= yeoman.app %>/')
ignorePath: new RegExp('^<%%= yeoman.app %>/|../')
}<% if (compass) { %>,
sass: {
src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: '<%%= yeoman.app %>/bower_components/'
src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}bower_components\//
}<% } %>
},<% if (coffee) { %>

Expand Down Expand Up @@ -206,7 +220,7 @@ module.exports = function (grunt) {
imagesDir: '<%%= yeoman.app %>/images',
javascriptsDir: '<%%= yeoman.app %>/scripts',
fontsDir: '<%%= yeoman.app %>/styles/fonts',
importPath: '<%%= yeoman.app %>/bower_components',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
Expand Down Expand Up @@ -376,9 +390,10 @@ module.exports = function (grunt) {
src: ['generated/*']
}<% if (bootstrap) { %>, {
expand: true,
cwd: '<%%= yeoman.app %><%
if (!compassBootstrap) {
%>/bower_components/bootstrap/dist<%
cwd: '<% if (!compassBootstrap) {
%>bower_components/bootstrap/dist<%
} else {
%>.<%
} %>',
src: '<% if (compassBootstrap) {
%>bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap<%
Expand Down
2 changes: 1 addition & 1 deletion templates/common/root/_bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory": "<%= appPath %>/bower_components"
"directory": "bower_components"
}
2 changes: 1 addition & 1 deletion templates/common/root/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node_modules
dist
.tmp
.sass-cache
<%= appPath %>/bower_components
bower_components

0 comments on commit 396a2c0

Please sign in to comment.