Bower component are not created on mvn command - angularjs

My bower_component are not created. I have one dev profile inside my pom.xml file and when I execute the command mvn clean install -P dev I get error Warning: Unable to read "C:\test-widgets\xcomponent-widgets\target/bower_components/angular-animate/angular-animate.js" file (Error code: ENOENT). Use --force to continue.
My dev profile looks like this
<profile>
<id>dev</id>
<properties>
<grunt.build.file>gruntfile-dev.js</grunt.build.file>
<bower.components.dir>webapp/bower_components</bower.components.dir>
</properties>
<build>
<plugins>
<!-- For development, launch the grunt serve after compile phase -->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
<configuration>
<workingDirectory>${basedir}/target</workingDirectory>
</configuration>
<executions>
<execution>
<id>grunt-fix-ngdocs</id>
<phase>none</phase>
</execution>
<execution>
<id>grunt-build</id>
<phase>compile</phase>
<goals>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
<execution>
<id>grunt-dist</id>
<phase>none</phase>
</execution>
<execution>
<id>grunt-serve</id>
<phase>test</phase>
<goals>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>serve</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${project.build.directory}</directory>
<excludes>
<exclude>**/node/**</exclude>
<exclude>**/node_modules/**</exclude>
</excludes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</profile>
and my grunt file dev.js looks like this
'use strict';
// Grunt file for de only
// Removed tasks for dist
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Project settings
yeoman: {
// configurable paths
app: require('${project.build.directory}/bower.json').appPath || 'components',
sources: '${basedir}/src/main/webapp/components',
modules: '${basedir}/src/main/webapp/modules',
sourcesSass: '${basedir}/src/main/webapp/components',
testSources: '${basedir}/src/test',
resourcesDocs: '${basedir}/src/main/resources/docs',
base: '${basedir}',
// Target folder where all generated files are placed
target: '${project.build.directory}',
// Distribution folder is defined on target\dist
dist: '${project.build.directory}/dist',
// Minimal distribution folder is defined on target\binDist
binDist: '${project.build.directory}/binDist',
// Distribution folder for vendor assets
vendor: '${project.build.directory}/dist/vendor',
// Documentation folder is defined on target\docs
docs: '${project.build.directory}/docs',
tmp: '${project.build.directory}/.tmp',
bower: '${project.build.directory}/bower_components'
},
watch: {
docJS: {
files: ['<%= yeoman.sources %>/**/*.*'],
tasks: ['jsdocs'],
options: {
livereload: true,
}
},
docSCSS: {
files: ['<%= yeoman.sources %>/**/*.scss'],
tasks: ['compass', 'jsdocs'],
options: {
livereload: true,
}
}
},
// Empties folders to start fresh
clean: {
options: {
force: true
},
// Clean target index html
targetIndexHtml: {
files: [
{
src: '<%= yeoman.target %>/index.html'
}
]
},
// Clean target template cache
targetTemplateCache: {
files: [
{
src: '<%= yeoman.target %>/<%= pkg.name %>-template-cache.js'
}
]
},
// Clean build folder .tmp
targetTemp: {
files: [
{
dot: true,
src: '<%= yeoman.target %>/.tmp'
}
]
},
// Clean build folder components
targetComponents: {
files: [
{
dot: true,
src: '<%= yeoman.target %>/components'
}
]
},
// Clean build folder css
targetCSS: {
files: [
{
dot: true,
src: '<%= yeoman.target %>/css'
}
]
},
// Clean distribution folder
dist: {
files: [
{
dot: true,
src: '<%= yeoman.dist %>'
}
]
},
// Clean minimal distribution folder
binDist: {
files: [
{
dot: true,
src: '<%= yeoman.binDist %>'
}
]
},
// Clean documentation folder
docs: {
files: [
{
dot: true,
src: '<%= yeoman.docs %>'
},
{
dot: true,
src: '<%= yeoman.tmp %>/doc'
}
]
}
},
// Copies files to places other tasks can use
copy: {
// Copy sources javascript to build directory
targetJS: {
files: [
{
expand: true,
dot: true,
cwd: '<%= yeoman.sources %>',
dest: '<%= yeoman.target %>/components',
src: [
'**/*.js',
'*/*'
]
}
]
},
// Copy index html page to build directory
targetIndexHtml: {
files: [
{
src: '${basedir}/src/main/webapp/index.html',
dest: '<%= yeoman.target %>/index.html'
}
]
},
docsFont: {
files: [
{
expand: true,
cwd: '<%= yeoman.bower %>/font-awesome/fonts/',
dest: '<%= yeoman.docs %>/fonts/',
src: ['**/*.*']
},
{
expand: true,
cwd: '<%= yeoman.sources %>/vendor/black-tie/fonts/',
dest: '<%= yeoman.docs %>/fonts/',
src: ['**/*.*']
},
{
expand: true,
cwd: '<%= yeoman.bower %>/bootstrap/fonts/',
dest: '<%= yeoman.docs %>/fonts/',
src: ['**/*.*']
}
]
},
docsBootstrap: {
files: [
{
expand: true,
cwd: 'bower_components/bootstrap/dist/css/',
dest: '<%= yeoman.docs %>/css/',
src: ['*.map']
}
]
},
docsResource: {
files: [
{
expand: true,
dot: true,
cwd: '<%= yeoman.resourcesDocs %>',
dest: '<%= yeoman.docs %>/doc_resource/',
src: ['**/*.pdf', '**/*.json']
}
]
},
docsTimeline: {
files: [
{
expand: true,
cwd: '<%= yeoman.sources %>/vendor/TimelineJS/build',
dest: '<%= yeoman.docs %>',
src: ['css/**/*.*']
}
]
},
docsPdf: {
files: [
{
expand: true,
dot: true,
cwd: '<%= yeoman.target %>/xcomponent-customization/pdfViewer',
dest: '<%= yeoman.docs %>/pdfViewer/',
src: ['**']
}
]
},
ngDocsPatch: {
// T2i fix for ng-docs issue that routing does not work in AngularjS 1.6
files: [
{
expand: true,
dot: true,
cwd: '<%= yeoman.resourcesDocs %>',
dest: '${project.build.directory}/node_modules/grunt-ngdocs/src/templates/js',
src: ['docs.js']
}
]
}
},
// Generate javascript template cache file
ngtemplates: {
options: {
url: function (url) {
return url.split("/").pop();
},
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true, // Only if you don't use comment directives!
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
'xcomponent-widgets': {
cwd: '<%= yeoman.sources %>',
src: ['**/*-template.html', '**/*-tpl.html', '**/template/*.html', '**/templates/*.html'],
dest: '<%= yeoman.target %>/<%= pkg.name %>-template-cache.js'
},
// module enhancement
't2i-common': {
cwd: '<%= yeoman.sources %>',
src: ['**/dialog-box.html', '**/t2i-spinner.html', '**/search-field.html', '**/version-display.html', '**/t2i-badge.html'],
dest: '<%= yeoman.target %>/templates/t2i-common-template-cache.js'
},
'pdf-viewer': {
cwd: '<%= yeoman.sources %>/pdf-viewer',
src: ['**/*.html'],
dest: '<%= yeoman.target %>/templates/pdf-viewer-template-cache.js'
},
'vertical-menu': {
cwd: '<%= yeoman.sources %>/vertical-menu',
src: ['**/*.html'],
dest: '<%= yeoman.target %>/templates/vertical-menu-template-cache.js'
},
'object-display-list': {
cwd: '<%= yeoman.sources %>',
src: ['**/*object-display-list/*.html'],
dest: '<%= yeoman.target %>/templates/object-display-list-template-cache.js'
},
'multiple-fields-group': {
cwd: '<%= yeoman.sources %>',
src: ['**/*multiple-fields-group/*.html'],
dest: '<%= yeoman.target %>/templates/multiple-fields-group-template-cache.js'
},
'multiple-search-and-select': {
cwd: '<%= yeoman.sources %>',
src: ['**/*multiple-search-and-select/*.html'],
dest: '<%= yeoman.target %>/templates/multiple-search-and-select-template-cache.js'
},
'lookup-text-field': {
cwd: '<%= yeoman.sources %>',
src: ['**/*lookup-text-field/*.html'],
dest: '<%= yeoman.target %>/templates/lookup-text-field-template-cache.js'
},
'attach-document': {
cwd: '<%= yeoman.sources %>',
src: ['**/*attach-document/*.html'],
dest: '<%= yeoman.target %>/templates/attach-document-template-cache.js'
},
'bread-crumb': {
cwd: '<%= yeoman.sources %>',
src: ['**/bread-crumb/*.html'],
dest: '<%= yeoman.target %>/templates/bread-crumb-template-cache.js'
},
'calendar-navigation': {
cwd: '<%= yeoman.sources %>',
src: ['**/calendar-navigation/*.html'],
dest: '<%= yeoman.target %>/templates/calendar-navigation-template-cache.js'
},
'date-histogram-filter': {
cwd: '<%= yeoman.sources %>',
src: ['**/date-histogram-filter/*.html'],
dest: '<%= yeoman.target %>/templates/date-histogram-filter-template-cache.js'
},
'date-histogram-select-box-filter': {
cwd: '<%= yeoman.sources %>',
src: ['**/date-histogram-select-box-filter/*.html'],
dest: '<%= yeoman.target %>/templates/date-histogram-select-box-filter-template-cache.js'
},
'object-display-paginated-tile': {
cwd: '<%= yeoman.sources %>',
src: ['**/object-display-paginated-tile/*.html'],
dest: '<%= yeoman.target %>/templates/object-display-paginated-tile-template-cache.js'
},
'event-category-display-list': {
cwd: '<%= yeoman.sources %>',
src: ['**/event-category-display-list/**/*.html'],
dest: '<%= yeoman.target %>/templates/event-category-display-list-template-cache.js'
},
'event-tile': {
cwd: '<%= yeoman.sources %>',
src: ['**/event-tile/**/*.html'],
dest: '<%= yeoman.target %>/templates/event-tile-template-cache.js'
},
'file-manager-tile': {
cwd: '<%= yeoman.sources %>',
src: ['**/file-manager-tile/*.html'],
dest: '<%= yeoman.target %>/templates/file-manager-tile-template-cache.js'
},
'filter-sidebar': {
cwd: '<%= yeoman.sources %>',
src: ['**/filter-sidebar/*.html'],
dest: '<%= yeoman.target %>/templates/filter-sidebar-template-cache.js'
},
'flexicard-calendar': {
cwd: '<%= yeoman.sources %>',
src: ['**/flexicard-calendar/*.html'],
dest: '<%= yeoman.target %>/templates/flexicard-calendar-template-cache.js'
},
'vertical-floating-toolbar': {
cwd: '<%= yeoman.sources %>',
src: ['**/vertical-floating-toolbar/*.html','**/floating-circle-button/*.html'],
dest: '<%= yeoman.target %>/templates/vertical-floating-toolbar-template-cache.js'
},
'form-paging': {
cwd: '<%= yeoman.sources %>',
src: ['**/form-paging/*.html'],
dest: '<%= yeoman.target %>/templates/form-paging-template-cache.js'
},
'theme-dropdown-button': {
cwd: '<%= yeoman.sources %>',
src: ['**/theme-dropdown-button/*.html'],
dest: '<%= yeoman.target %>/templates/theme-dropdown-button-template-cache.js'
},
'toolbar': {
cwd: '<%= yeoman.sources %>',
src: ['**/toolbar/*.html'],
dest: '<%= yeoman.target %>/templates/toolbar-template-cache.js'
},
'workflow-display': {
cwd: '<%= yeoman.sources %>',
src: ['**/workflow-display/*.html'],
dest: '<%= yeoman.target %>/templates/workflow-display-template-cache.js'
},
'year-navigator-with-legend': {
cwd: '<%= yeoman.sources %>',
src: ['**/year-navigator-with-legend/*.html'],
dest: '<%= yeoman.target %>/templates/year-navigator-with-legend-template-cache.js'
},
'variable-list-edit': {
cwd: '<%= yeoman.sources %>',
src: ['**/variable-list-edit/*.html'],
dest: '<%= yeoman.target %>/templates/variable-list-edit-template-cache.js'
},
},
// Create javaScript docs
ngdocs: {
options: {
dest: '<%= yeoman.docs %>',
editExample: false,
scripts: [
'https://code.jquery.com/jquery-1.11.2.min.js',
'https://code.jquery.com/jquery-migrate-1.2.1.min.js',
'<%= yeoman.target %>/.tmp/concat/vendor/<%= pkg.name %>-vendor.js',
'<%= yeoman.target %>/bower_components/angular-animate/angular-animate.js',
'<%= yeoman.target %>/bower_components/iscroll/build/iscroll-probe.js',
'<%= yeoman.target %>/bower_components/ng-file-upload/ng-file-upload.js',
'<%= yeoman.target %>/<%= pkg.name %>.js',
'<%= yeoman.sources %>/vendor/TimelineJS/build/js/storyjs-embed.js',
'<%= yeoman.resourcesDocs %>/documentation_override.js',
'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'
],
styles: [
'<%= yeoman.target %>/.tmp/concat/vendor/<%= pkg.name %>-vendor.css',
'<%= yeoman.target %>/<%= pkg.name %>.css',
'<%= yeoman.sources %>/vendor/TimelineJS/build/css/timeline.css',
'<%= yeoman.resourcesDocs %>/documentation_override.css'
],
html5Mode: false,
startPage: '/api',
title: "xcomponent-widget-js",
bestMatch: true
},
api: {
src: ['<%= yeoman.sources %>/**/*.js', '<%= yeoman.resourcesDocs %>/api/*.ngdoc'],
title: 'API Documentation'
}
},
ngAnnotate: {
dist: {
files: [
{
expand: true,
src: [
'<%= yeoman.target %>/xcomponent-widgets-js-template-cache.js',
'<%= yeoman.target %>/components/**/*.js',
'<%= yeoman.target %>/scripts/**/*.js'
]
}
]
}
},
useminPrepare: {
html: ['<%= yeoman.target %>/index.html'],
options: {
dest: '<%= yeoman.target %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['concat', 'cssmin'],
copy: ['concat']
},
post: {}
}
}
}
},
usemin: {
html: ['<%= yeoman.target %>/{,*/}*.html'],
css: ['<%= yeoman.target %>/styles/{,*/}*.css'],
options: {
dirs: ['<%= yeoman.target %>'],
assetsDirs: [
'<%= yeoman.target %>',
'<%= yeoman.target %>/images',
'<%= yeoman.target %>/styles']
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
dist: {
options: {
sassDir: '<%= yeoman.sources %>/',
cssDir: '<%= yeoman.target %>/css',
relativeAssets: true,
assetCacheBuster: false,
generatedImagesDir: '<%= yeoman.target %>/images',
httpPath: ".",
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images',
httpFontsPath: '/fonts',
raw: 'Sass::Script::Number.precision = 10\n'
}
}
},
// Minify css files
cssmin: {
// Concat and minify all css on the distribution folder
dist: {
files: {
'<%= yeoman.target %>/<%= pkg.name %>.min.css': [
'<%= yeoman.target %>/css/**/*.css'
]
}
}
},
// Minify js files
uglify: {
options: {
mangle: false
},
dist: {
files: {
'<%= yeoman.target %>/<%= pkg.name %>.min.js': [
'<%= yeoman.target %>/<%= pkg.name %>.js'
]
}
},
distTemplate: {
files: {
'<%= yeoman.target %>/dist/scripts/<%= pkg.name %>-template.min.js': [
'<%= yeoman.target %>/.tmp/concat/scripts/<%= pkg.name %>-template.js'
]
}
},
distCore: {
files: {
'<%= yeoman.target %>/dist/scripts/<%= pkg.name %>-core.min.js': [
'<%= yeoman.target %>/.tmp/concat/scripts/<%= pkg.name %>-core.js'
]
}
},
distOrganigram: {
files: {
'<%= yeoman.target %>/dist/scripts/<%= pkg.name %>-organigram.min.js': [
'<%= yeoman.target %>/.tmp/concat/scripts/<%= pkg.name %>-organigram.js'
]
}
},
distParameterValue: {
files: {
'<%= yeoman.target %>/dist/scripts/<%= pkg.name %>-parameter-value.min.js': [
'<%= yeoman.target %>/.tmp/concat/scripts/<%= pkg.name %>-parameter-value.js'
]
}
},
distTimeline: {
files: {
'<%= yeoman.target %>/dist/scripts/<%= pkg.name %>-timeline.min.js': [
'<%= yeoman.target %>/.tmp/concat/scripts/<%= pkg.name %>-timeline.js'
]
}
},
distFile: {
files: {
'<%= yeoman.target %>/dist/scripts/<%= pkg.name %>-file.min.js': [
'<%= yeoman.target %>/.tmp/concat/scripts/<%= pkg.name %>-file.js'
]
}
},
},
concat: {
// Concat all sources
jsTargetAll: {
src: [
// begin t2i modules in xcomponent-widgets
'<%= yeoman.modules %>/*.js',
// end t2i modules in xcomponent-widgets
'<%= yeoman.sources %>/**/*.js',
'<%= yeoman.target %>/xcomponent-customization/angular-strap/angular-strap.js',
'<%= yeoman.target %>/xcomponent-customization/angular-strap/angular-strap.tpl.js',
'!<%= yeoman.sources %>/vendor/TimelineJS/build/js/storyjs-embed.js',
'<%= yeoman.target %>/<%= pkg.name %>-template-cache.js',
// begin t2i modules in xcomponent-widgets
'<%= yeoman.target %>/templates/*.js',
// end t2i modules in xcomponent-widgets
],
dest: '<%= yeoman.target %>/<%= pkg.name %>.js'
},
jsTargetNoTemplateCache: {
src: [
'<%= yeoman.sources %>/xcomponent-widgets.js',
'<%= yeoman.sources %>/**/*.js',
'!<%= yeoman.sources %>/xcomponent-widgets-tpl-cache.js'
],
dest: '<%= yeoman.target %>/<%= pkg.name %>-without-template-cache.js'
},
// Concat all css
cssDist: {
src: ['<%= yeoman.target %>/css/**/*.css'],
dest: '<%= yeoman.target %>/<%= pkg.name %>.css'
}
},
connect: {
doc: {
options: {
port: 9010,
base: '<%= yeoman.docs %>',
open: "http://localhost:9010/#/api",
hostname: '0.0.0.0',
livereload: true
}
}
}
});
grunt.registerTask('jsdocs', [
"clean:docs",
'newer:copy:targetIndexHtml',
'newer:copy:targetJS',
'ngtemplates', // Generate template cache
'newer:compass', // Compile scss to css
'useminPrepare', // Prepare usemin tasks for minification
'concat', // Concat sources for distribution
'ngAnnotate',
'usemin',
'copyDocs', // Copy resources for documentation,
'ngdocs' // Build documentation
]);
grunt.registerTask('copyDocs', [
'copy:docsResource',
'copy:docsTimeline',
'copy:docsPdf',
'copy:docsFont',
'copy:docsBootstrap',
]);
// 1. Run grunt build by frontend-maven-plugin
grunt.registerTask('build', [
'clean', // Clean folders
'copy:targetIndexHtml',
'copy:targetJS',
'ngtemplates', // Generate template cache
'compass', // Compile scss to css
'useminPrepare', // Prepare usemin tasks for minification
'concat', // Concat sources for distribution
'ngAnnotate',
'usemin'
]);
// 2. Build pdf js (npm run build-pdf-js) in frontend-maven-plugin
// 3. Run grunt dist by frontend-maven-plugin
grunt.registerTask('serve', [
'copyDocs', // Copy resources for documentation,
'ngdocs', // Build documentation
'connect:doc',
'watch'
]);
grunt.registerTask('dist', [
]);
};
where is the mistake ? I can't find out why when i execute the command the bower_components folder with the dependencies is not created
I tried to change the <bower.components.dir> from webapp/bower_components to bower_components to search
on the root but after that I get error
Warning: Unable to create directory "C:\test-widgets\xcomponent-widgets\target\components\bread-crumb"

Related

How can I include css and image files into my AngularJS project using grunt?

I have an AngularJS project, created using the Yeoman template. I'm trying to build the final distribution with Grunt, using 'grunt build'.
The problem is that some of my CSS, JavaScript, and image files are not in the standard scripts/ or styles/ directory inside my app folder - instead, there is an assets/css, assets/js, and assets/images directory containing that stuff.
I don't know anything about customizing the gruntfile.js. Can somebody give me a quick pointer about how to include those directories in the assets/ folder for my final distribution? Thank you!
Here is my current Gruntfile.js, as generated by Yeoman with no customizations:
// Generated on 2018-02-09 using generator-angular 0.16.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Automatically load required Grunt tasks
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn'
});
// 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: appConfig,
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['newer:jshint:all', 'newer:jscs:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
},
styles: {
files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
tasks: ['newer:copy:styles', 'postcss']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect().use(
'/app/styles',
connect.static('./app/styles')
),
connect.static(appConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
// Make sure there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
// Make sure code styles are up to par
jscs: {
options: {
config: '.jscsrc',
verbose: true
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
src: ['test/spec/{,*/}*.js']
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
postcss: {
options: {
processors: [
require('autoprefixer-core')({browsers: ['last 1 version']})
]
},
server: {
options: {
map: true
},
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes:{
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
}
},
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/images',
'<%= yeoman.dist %>/styles'
],
patterns: {
js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
}
}
},
// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
ngtemplates: {
dist: {
options: {
module: 'waitlistAngularApp',
htmlmin: '<%= htmlmin.dist.options %>',
usemin: 'scripts/scripts.js'
},
cwd: '<%= yeoman.app %>',
src: 'views/{,*/}*.html',
dest: '.tmp/templateCache.js'
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'copy:styles'
],
test: [
'copy:styles'
],
dist: [
'copy:styles',
'imagemin',
'svgmin'
]
},
// Test settings
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'postcss:server',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});
grunt.registerTask('test', [
'clean:server',
'wiredep',
'concurrent:test',
'postcss',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'postcss',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'newer:jscs',
'test',
'build'
]);
};
I found the problem. Apparently the auto-generated files from Yeoman are pointing to a .tmp directory for your CSS files. If you get rid of the (.tmp), as shown below, then everything works correctly.
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="styles/aux.css">
<!-- endbuild —>
Remove the (.tmp), so you get this instead:
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="styles/aux.css">
<!-- endbuild -->
For images, I needed to add 'assets/images/*' to the src property, as shown below:
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'fonts/*',
'resources/*',
'assets/images/*',
'*.{ico,png,txt}',
'*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},

Grunt serve: "Cannot GET <url>" on URL with variables

I have an URL in the format http://url.com/reset?email=foo%40bar.com which works fine on production, but I'm not able to get it to work locally with grunt. There are no errors in the console, but just a white browser page that states
Cannot GET /reset?email=foo%40bar.com
First thought that might be a wrong configuration of the angular route, but then there'd be a JS error I guess. My grunt settings (sorry for the long code, but I don't know Grunt well enough to be 100% sure what to rule out):
// Generated on 2015-02-14 using generator-angular 0.11.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
var modRewrite = require('connect-modrewrite');
module.exports = function (grunt) {
// Load grunt sloc for counting code lines
grunt.loadNpmTasks('grunt-sloc');
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
var serveStatic = require('serve-static');
// Configurable paths for the application
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'dist'
};
// Define the configuration for all the tasks
grunt.initConfig({
// Count code lines
sloc: {
'scripts': {
options: {
reportType: 'json',
reportPath: './app/sloc_scripts.json',
},
files: {
'app/scripts/': ['**.js'],
'app/scripts/*/': ['**.js'],
'app/styles/': ['**.scss'],
'app/views/system/': ['**.html'],
'app/views/website/content/': ['**.html'],
'app/views/website/menus/': ['**.html']
}
},
'vendors': {
options: {
reportType: 'json',
reportPath: './app/sloc_vendors.json',
},
files: {
'.tmp/concat/scripts/': ['vendor.js'],
'.tmp/styles/': ['main.css']
}
}
},
// Project settings
yeoman: appConfig,
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['newer:jshint:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'karma']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'<%= yeoman.app %>/**/*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function(connect) {
return [
serveStatic('.tmp'),
modRewrite(['^[^\\.]*$ /index.html [L]']),
connect().use('/bower_components', serveStatic('./bower_components')),
connect().use('/app/styles', serveStatic('./app/styles')),
serveStatic(appConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
middleware: function(connect) {
return [
serveStatic('.tmp'),
serveStatic('test'),
connect().use('/bower_components', serveStatic('./bower_components')),
serveStatic(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 1 version']
},
server: {
options: {
map: true,
},
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes:{
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
},
sass: {
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}bower_components\//
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
sourcemap: true
}
}
},
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/styles/fonts/*',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif}'
]
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: [
'<%= yeoman.dist %>/{,*/}*.html',
'<%= yeoman.dist %>/views/website/content{,*/}*.html',
'<%= yeoman.dist %>/views/website/menus{,*/}*.html',
'<%= yeoman.dist %>/views/system{,*/}*.html',
'<%= yeoman.dist %>/views/website/content/studies/{,*/}*.html',
'<%= yeoman.dist %>/views/website/content/guides/{,*/}*.html',
'<%= yeoman.dist %>/views/website/content/insights/{,*/}*.html'
],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/images',
'<%= yeoman.dist %>/styles',
'<%= yeoman.dist %>/scripts'
]
}
},
// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// options: {
// noRebase: true
// }
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html', 'views/website/content/{,*/}*.html', 'views/website/menus/{,*/}*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'views/website/content/{,*/}*.html',
'views/website/menus/{,*/}*.html',
'images/**/*',
'styles/fonts/{,*/}*.*',
'buttons/{,*/}*.*',
'downloads/{,*/}*.*',
'sloc_scripts.json',
'sloc_vendors.json'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}, {
expand: true,
cwd: '.',
src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
dest: '<%= yeoman.dist %>'
},
{
expand: true,
cwd: 'bower_components/angular-ui-grid/',
src: '*.{eot,svg,ttf,woff}',
dest: '<%= yeoman.dist %>/styles'
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'compass:server'
],
test: [
'compass'
],
dist: [
'compass:dist',
'imagemin',
'svgmin'
]
},
// Test settings
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'autoprefixer:server',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});
grunt.registerTask('test', [
'clean:server',
'wiredep',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'sloc',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
};
My angular route:
.state('reset', {
url: '/reset',
templateUrl: 'views/system/reset.html',
controller: 'ResetPasswordController'
})
The page is perfectly served if there are no url variables.
It looks like you are using UI Router? If so, it may benefit you to format your query parameters (?email=foo%40bar.com) as $stateParams; it may play nicer on localhost.
.state('reset', {
url: '/reset/:email',
templateUrl: 'views/system/reset.html',
controller: 'ResetPasswordController'
})
URL path would then be /reset/foo%40bar.com
Email address would be accessible in your controller as $stateParams.email (assuming $stateParams has been injected).

proxies not working in grunt in yeoman-angular-generator 0.7.1

I have one web server and one app server running on ports 7272 and 8181 respectively. The web server is scaffolded with yeoman-angular-generator(0.7.1). I had configured a proxy to serve up my APIs to facilitate development earlier and it was working fine. Later we decided to enable html5mode for angular and I enabled the connect-modrewrite to serve index.html when static files are not found. Strangely the proxies are not working now. I make the call to http://localhost:7272/api/v0.1//17 and it does not return the response for http://localhost:8181/api/v0.1//17... Any help? Would really appreciate it guys.
Here is my GruntFile:
// Generated on 2015-07-17 using generator-angular 0.7.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
grunt.loadNpmTasks('grunt-connect-proxy');
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'app',
dist: 'dist'
},
// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['newer:jshint:all'],
options: {
livereload: true
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'karma']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 7272,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost'
//livereload: 35729
},
proxies: [
{
context: '/api/v0.1',
host: 'localhost',
port: 8181,
https:'false'
}
],
livereload: {
options: {
open: {appName:"Firefox"},
base: [
'.tmp',
'<%= yeoman.app %>'
],
middleware: function (connect, options) {
var middlewares = [];
var modRewrite = require('connect-modrewrite');
middlewares.push(modRewrite(['!\\.\\w+($|\\?) /index.html [L]']))
middlewares.push(modRewrite(['!\\.html|\\.js|\\.svg|\\.css|\\.png|\\.jpg|\\.gif$|\\.woff|\\.ttf|\\eot|\\.woff2 /index.html [L]']))
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
// Serve static files
options.base.forEach(function(base) {
middlewares.push(connect.static(base));
});
// Setup the proxy
middlewares.push(require('grunt-connect-proxy/lib/utils').proxyRequest);
return middlewares;
}
}
},
test: {
options: {
port: 9001,
base: [
'.tmp',
'test',
'<%= yeoman.app %>'
]
}
},
dist: {
options: {
base: '<%= yeoman.dist %>'
}
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
],
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 1 version']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the app
'bower-install': {
app: {
html: '<%= yeoman.app %>/index.html',
ignorePath: '<%= yeoman.app %>/'
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
debugInfo: true
}
}
},
// Renames files for browser caching purposes
rev: {
dist: {
files: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*',
'!<%= yeoman.dist %>/images/ignore/**'
]
}
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>'
}
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: ['<%= yeoman.dist %>']
}
},
// The following *-min tasks produce minified files in the dist folder
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// Allow the use of non-minsafe AngularJS files. Automatically makes it
// minsafe compatible so Uglify does not destroy the ng references
ngmin: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'bower_components/**/*',
'images/{,*/}*.{webp,svg,ico}',
'images/ignore/{,*/}*.{svg}',
'fonts/{,*/}*.{eot,svg,ttf,woff,woff2}'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'compass:server'
],
test: [
'compass'
],
dist: [
'compass:dist',
'imagemin'
//'svgmin'
]
},
uglify: {
options: {
mangle: false
}
},
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css',
// '<%= yeoman.app %>/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
// Test settings
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'bower-install',
'concurrent:server',
'autoprefixer',
'configureProxies:server',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', function () {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve']);
});
grunt.registerTask('test', [
'clean:server',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'bower-install',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngmin',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'rev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
};

Grunt Build - Angular: app in dist folder does not work

I develope an angular app. After building with grunt build, the app in the dist folder does not work on mobile devices (tablet, phone, smart tv) only on PC.
It only loads the background of the page. It is strange, because if I deploy the app folder (so the whole project) it will be loaded..
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var yeomanConfig = {
app: 'app',
dist: 'dist'
};
try {
yeomanConfig.app = require('./bower.json').appPath || yeomanConfig.app;
} catch (e) {
}
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
yeoman: yeomanConfig,
watch: {
coffee: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
tasks: ['coffee:dist']
},
coffeeTest: {
files: ['test/spec/{,*/}*.coffee'],
tasks: ['coffee:test']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass']
},
livereload: {
files: [
'<%= yeoman.app %>/{,**/}*.{html,json}',
'{.tmp,<%= yeoman.app %>}/styles/{,**/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/{,**/}*.js',
'<%= yeoman.app %>/images/{,**/}*.{png,jpg,jpeg,gif,webp,svg}'
],
tasks: ['livereload']
}
},
connect: {
options: {
port: 9001,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost'
},
livereload: {
options: {
middleware: function (connect) {
return [
lrSnippet,
mountFolder(connect, '.tmp'),
mountFolder(connect, yeomanConfig.app)
];
}
}
},
test: {
options: {
middleware: function (connect) {
return [
mountFolder(connect, '.tmp'),
mountFolder(connect, 'test')
];
}
}
}
},
open: {
server: {
url: 'http://localhost:<%= connect.options.port %>'
}
},
clean: {
dist: {
files: [
{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}
]
},
server: '.tmp'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
},
unitWatch: {
configFile: 'karma.conf.js',
singleRun: false
}
},
coffee: {
dist: {
files: [
{
expand: true,
cwd: '<%= yeoman.app %>/scripts',
src: '{,*/}*.coffee',
dest: '.tmp/scripts',
ext: '.js'
}
]
},
test: {
files: [
{
expand: true,
cwd: 'test/spec',
src: '{,*/}*.coffee',
dest: '.tmp/spec',
ext: '.js'
}
]
}
},
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
//fontsDir: '<%= yeoman.app %>/styles/fonts',
//importPath: '<%= yeoman.app %>/components',
relativeAssets: true
},
dist: {
cssDir: '<%= yeoman.dist %>/images'
},
server: {
options: {
//debugInfo: true
}
}
},
concat: {
dist: {
files: {
'<%= yeoman.dist %>/scripts/scripts.js': [
'.tmp/scripts/{,*/}*.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
}
}
},
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>'
}
},
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
dirs: ['<%= yeoman.dist %>']
}
},
imagemin: {
dist: {
files: [
{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= yeoman.dist %>/images'
}
]
}
},
cssmin: {
dist: {
files: {
'<%= yeoman.dist %>/styles/main.css': [
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/styles/{,*/}*.css'
]
}
}
},
htmlmin: {
dist: {
options: {
/*removeCommentsFromCDATA: true,
// https://github.com/yeoman/grunt-usemin/issues/44
//collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeOptionalTags: true*/
},
files: [
{
expand: true,
cwd: '<%= yeoman.app %>',
src: ['*.html', 'views/*.html'],
dest: '<%= yeoman.dist %>'
}
]
}
},
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
ngmin: {
dist: {
files: [
{
expand: true,
cwd: '<%= yeoman.dist %>/scripts',
src: '*.js',
dest: '<%= yeoman.dist %>/scripts'
}
]
}
},
uglify: {
dist: {
files: {
'<%= yeoman.dist %>/scripts/scripts.js': [
'<%= yeoman.dist %>/scripts/scripts.js'
]
}
}
},
rev: {
dist: {
files: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
}
},
copy: {
compass: {
files: [
{
src: ['main.css'],
dest: '<%= yeoman.app %>/styles/',
filter: 'isFile',
expand: true,
flatten: true,
cwd: '.tmp/styles/'
}
]
},
conf: {
files: [
{
cwd: '<%= yeoman.app %>',
src: 'conf/*.json',
dest: '<%= yeoman.dist %>',
expand: true
}
]
},
dist: {
files: [
{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,txt}',
'.htaccess',
'components/**/*',
'images/{,*/}*.{gif,webp}',
'styles/fonts/*'
]
}
]
}
},
compress: {
main: {
options: {
archive: 'archive/<%= pkg.name %>_<%= pkg.version %>.zip',
mode: 'zip'
},
files: [
{
expand: true, src: '**/*', cwd: 'dist/'
}
]
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin'
}
},
'string-replace': {
version: {
files: {
'<%= yeoman.dist %>/views/main.html': '<%= yeoman.dist %>/views/main.html'
},
options: {
replacements: [
{
pattern: /{{ VERSION }}/g,
replacement: '<%= pkg.version %>'
}
]
}
}
}
});
grunt.renameTask('regarde', 'watch');
grunt.registerTask('server', [
'clean:server',
'coffee:dist',
'compass:server',
'livereload-start',
'connect:livereload',
'open',
'watch',
'karma:unitWatch'
]);
grunt.registerTask('test', [
'clean:server',
'coffee',
'compass',
'connect:test',
'karma:unit'
]);
grunt.registerTask('build', [
'clean:dist',
'coffee',
'compass:dist',
'copy:compass',
'useminPrepare',
'imagemin',
'cssmin',
'htmlmin',
'concat',
'copy',
'ngmin',
'uglify',
'rev',
'usemin',
'string-replace:version',
'compress'
]);
/*
Make a patch Release:
- increment version number
- build
- commit to git and create tag vor version
*/
grunt.registerTask('patch', [
//'test',
'bump-only:patch',
'build',
'bump-commit'
]);
/*
Make a minor Release:
- increment version number
- build
- commit to git and create tag vor version
*/
grunt.registerTask('release-minor', [
//'test',
'bump-only:minor',
'build',
'bump-commit'
]);
/*
Make a major Release:
- increment version number
- build
- commit to git and create tag vor version
*/
grunt.registerTask('release-major', [
//'test',
'bump-only:major',
'build',
'bump-commit'
]);
grunt.registerTask('default', ['build']);
};

Grunt build - Image name changed and is not found

I'm developing a website using the angular yeoman generator generator-angular. Everything seems to be working fine, except that in some files, when I run grunt build, image refs are not updated to the new image names.
This is a example:
I run:
$ grunt build
A dist/ directory is created in which an images/ subdirectory is also created and all images are copied there, but a revision hash is appended to the name:
image-one.png --> image-one.0b567c29.png
But my <img> tags in my html file are not updated with this new image file name.
What can I do to make this work?
This is my Gruntfile:
// Generated on 2015-04-15 using generator-angular 0.11.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(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: appConfig,
less: {
compile: {
options: {
paths: ['bower_components/{,*}*.less']
},
files: {
'<%= yeoman.app %>/styles/main.css': '<%= yeoman.app %>/styles/main.less'
}
}
},
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: [/*'newer:jshint:all'*/],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'karma']
},
styles: {
files: ['<%= yeoman.app %>/styles/{,*/}*.less'],
tasks: ['less:compile', 'newer:copy:styles', 'autoprefixer']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect().use(
'/app/styles',
connect.static('./app/styles')
),
connect.static(appConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 1 version']
},
server: {
options: {
map: true,
},
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes: {
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
}
},
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/images',
'<%= yeoman.dist %>/styles'
]
}
},
// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}, {
expand: true,
cwd: 'bower_components/bootstrap/dist',
src: 'fonts/*',
dest: '<%= yeoman.dist %>'
}, {
expand: true,
flatten: true,
src: [
'bower_components/components-font-awesome/fonts/*',
'bower_components/bootstrap/fonts/*'
],
dest: '<%= yeoman.dist %>/fonts'
}, {
expand: true,
flatten: true,
src: [
'<%= yeoman.app %>/locales/*',
],
dest: '<%= yeoman.dist %>/locales'
}, {
expand: true,
flatten: true,
src: [
'divshot.json',
],
dest: '<%= yeoman.dist %>'
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'copy:styles'
],
test: [
'copy:styles'
],
dist: [
'copy:styles',
'imagemin',
'svgmin'
]
},
// Test settings
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'less:compile',
'wiredep',
'concurrent:server',
'autoprefixer:server',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});
grunt.registerTask('test', [
'clean:server',
'wiredep',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'less:compile',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
grunt.loadNpmTasks('grunt-contrib-less');
};
I would comment out these lines:
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
// '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
}

Resources