Skip to content

Commit

Permalink
added grunt watch configuration
Browse files Browse the repository at this point in the history
Marco Poehler committed Aug 11, 2014
1 parent 6de424a commit 8386c87
Showing 5 changed files with 82 additions and 14 deletions.
24 changes: 13 additions & 11 deletions webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -78,21 +78,11 @@
<!-- relative to src/main/webapp/, default: static -->
<jsSourceDirectory>static</jsSourceDirectory>

<!-- example options usage to get verbose output in logs -->
<!-- get verbose output in logs -->
<gruntOptions>
<gruntOption>--verbose</gruntOption>
</gruntOptions>

<!-- example npm install env variable -->
<npmEnvironmentVar>
<PHANTOMJS_CDNURL>http://cnpmjs.org/downloads</PHANTOMJS_CDNURL>
</npmEnvironmentVar>

<!-- example options usage to filter variables in given resource -->
<filteredResources>
<filteredResource>maven-properties.json</filteredResource>
</filteredResources>

</configuration>
<executions>
<execution>
@@ -106,6 +96,18 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>target</directory>
<directory>target-grunt</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</project>
35 changes: 33 additions & 2 deletions webapp/src/main/webapp/static/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@ module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

gruntMavenProperties: grunt.file.readJSON('grunt-maven.json'),

concat: {
options: {
separator: ';'
@@ -11,6 +14,7 @@ module.exports = function(grunt) {
dest: 'dist/<%= pkg.name %>.js'
}
},

uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
@@ -20,11 +24,38 @@ module.exports = function(grunt) {
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
}
},

mavenPrepare: {
options: {
resources: ['**']
},
prepare: {}
},

mavenDist: {
options: {
warName: '',
deliverables: ['optiker-verzeichnis.min.js'],
gruntDistDir: 'dist'
},
dist: {}
},

watch: {
maven: {
files: ['../src/main/webapp/static/*.js'],
tasks: ['default'],
options: {
}
}
}
});

grunt.loadNpmTasks('grunt-maven');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['concat', 'uglify']);
grunt.registerTask('default', ['mavenPrepare','concat', 'uglify', 'mavenDist']);
};
26 changes: 26 additions & 0 deletions webapp/src/main/webapp/static/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

/* App Module */

var klpvAdminApp = angular.module('OptikerVerzeichnisApp', [
'ngRoute'
]);




klpvAdminApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/optiker/:city/:name', {
templateUrl: 'optiker.html',
controller: 'OptikerDetailsCtrl'
}).
when('/', {
templateUrl: 'homepage.html',
controller: 'HonepageCtrl'
}).
otherwise({
redirectTo: '/'
});
}]);
7 changes: 7 additions & 0 deletions webapp/src/main/webapp/static/grunt-maven.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"projectRootPath": "../",
"targetPath": "../target/webapp-1.0",
"sourceDirectory": "src",
"jsSourceDirectory": "static",
"filteredFiles": []
}
4 changes: 3 additions & 1 deletion webapp/src/main/webapp/static/package.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
"version": "1.0.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-maven": "~1.1.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-uglify": "~0.5.1"
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-watch": "~0.6.1"
}
}

0 comments on commit 8386c87

Please sign in to comment.