Is there any configuration file or something we can change in yeoman that would set the "app" directory to something else? I work with Zend Framework 2 and it uses the "public" directory as the root yeoman uses "app".
I see that I can directory name in the Grunt.js file but it would be nice to reset the defaults in yeoman.
Is there any configuration file or something we can change in yeoman that would set the "app" directory to something else? I work with Zend Framework 2 and it uses the "public" directory as the root yeoman uses "app".
I see that I can directory name in the Grunt.js file but it would be nice to reset the defaults in yeoman.
Share Improve this question edited Feb 25, 2013 at 0:04 tckmn 59.3k27 gold badges117 silver badges156 bronze badges asked Feb 25, 2013 at 0:02 SubtubesSubtubes 16.9k24 gold badges75 silver badges107 bronze badges 2- 4 Please don't include "Any input is greatly appreciated." in your question. It is useless noise. – tckmn Commented Feb 25, 2013 at 0:04
- What version of Yeoman are you running? – Allan Kimmer Jensen Commented Feb 25, 2013 at 8:47
6 Answers
Reset to default 7You want to change the Gruntfile.js
settings, as from version 1.0 everything is listed here, and build is done by Grunt only.
As they write on the website:
Yo scaffolds out a new application, writing your Grunt configuration and pulling in relevant Grunt tasks that you might need for your build.
Bower is used for dependency management, so that you no longer have to manually download and manage your scripts.
Grunt is used to build, preview and test your project, thanks to help from tasks curated by the Yeoman team and grunt-contrib.
I can't remember where the old settings was in the gruntfile, but in version 1.0 is at line 11 and looks like this:
// configurable paths
var yeomanConfig = {
app: 'app',
dist: 'dist'
};
With version 1.4.7 :
1) For app directory :
Gruntfile.js :
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'www'
};
index.html :
<!-- build:js({.tmp,app}) scripts/scripts.js -->
bower.json :
"appPath": "app"
test/karma.conf.js
'app/scripts/**/*.js'
2) for the dist directory :
Only in Gruntfile.js
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'www'
};
for Angular generator version 0.9.5 works for me:
- change folder name from to app to anything you need, for example 'clientapp'
- edit gruntfile.js, change in appConfig app: 'clientapp'
- edit bower.json change line "appPath": "clientapp"
in renamed folder find index.html, then find and edit part in comment
build:js({.tmp,clientapp}) scripts/scripts.js
in folder test find karma.conf.js and change app to 'clientapp' in files section
Update to 1.0 and edit your Gruntfile.js
// configurable paths
var yeomanConfig = {
**app: 'app',**
dist: 'dist'
};
Sorry for resurrecting this, however I have found a few locations which this needs to change and feel that I can add some value:
I use Laravel, which uses an app and public folder, and have never used zend, but am assuming that something similar should apply.
install Yeoman generated app into yeoman
:
/[zendapproot]/
mkdir yeoman && cd yeoman
yo angular [appName]
/[zendapproot]/yeoman/
append contents of `/[zendapproot]/yeoman/.gitignore` into `/[zendapproot]/.gitignore`
move everything except the app directory into /[zendapproot]/
edit .bowerrc
{
"directory": "yeoman/app/bower_components"
}
edit Gruntfile.js to change app and dist folders
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'yeoman',
dist: 'public/assets'
},
edit karma.conf.js
files: [
'yeoman/app/bower_components/angular/angular.js',
'yeoman/app/bower_components/angular-mocks/angular-mocks.js',
'yeoman/app/bower_components/angular-resource/angular-resource.js',
'yeoman/app/bower_components/angular-cookies/angular-cookies.js',
'yeoman/app/bower_components/angular-sanitize/angular-sanitize.js',
'yeoman/app/bower_components/angular-route/angular-route.js',
'yeoman/app/scripts/*.js',
'yeoman/app/scripts/**/*.js',
'yeoman/app/test/mock/**/*.js',
'yeoman/app/test/spec/**/*.js'
],
run grunt test
to ensure that testing is working.
run grunt serve
to serve the webapp in a testing env
run grunt
to build which should store the app in public/assets
Now this is the part I am not sure on...
At present, I remove htmlmin
and rev
from grunt.registerTask('build'...
in Gruntfile.js
to stop html minification and to stop assets being renamed.
I then open up my master view template from Laravel (Zend in your case), and change the scripts and styles to that provided in the grunt built index.html /public/assets/index.html
If anybody has a better way of tackling the above, please share. e.g. in relation to passing the renamed asset filenames to the zend/laravel application view templates.
When creating a new project (for angular at least), there is a cmd line arg for this: --appPath=[newPath]:
yo angular --appPath=public
How to change the dist folder name:
Additionally, for anyone that ends up here looking for how to change the dist folder name (as I did): There is no cmd line arg that I could find, so you need to manually edit Gruntfile.js at line 21 after creating your project, but before running grunt:
// Configurable paths for the application
var appConfig = {
app: require('./bower.json').appPath || 'app',
//dist: 'dist'
dist: 'public'
};