tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
238 stars 57 forks source link

Feature/reliable templates #62

Closed treyhyde closed 8 years ago

treyhyde commented 9 years ago

My "works for me" solution to issue #35. Up for discussion.

See companion patch to Gruntfile.js in commit (or pasted right here below)

diff --git a/ui/Gruntfile.js b/ui/Gruntfile.js
index a5365af..225ae08 100644
--- a/ui/Gruntfile.js
+++ b/ui/Gruntfile.js
@@ -132,6 +132,12 @@ module.exports = function (grunt) {

     // Empties folders to start fresh
     clean: {
+      twirl: {
+        files: [{
+          dot: true,
+          src:['twirl']
+        }]
+      },
       dist: {
         files: [{
           dot: true,
@@ -333,6 +339,24 @@ module.exports = function (grunt) {

     // Copies remaining files to places other tasks can use
     copy: {
+      'twirl-dev': {
+        files: [{
+           expand: true,
+           dot: true,
+           cwd: '<%= yeoman.app %>',
+           dest: 'twirl',
+           src: ['*.scala.html']
+        }]
+      },
+      'twirl-dist': {
+         files: [{
+           expand: true,
+           dot: true,
+           cwd: '<%= yeoman.dist %>',
+           dest: 'twirl',
+           src: ['*.scala.html']
+         }]
+      },
       dist: {
         files: [{
           expand: true,
@@ -400,7 +424,6 @@ module.exports = function (grunt) {
     grunt.task.run([
       'clean:server',
       'wiredep',
-      'concurrent:server',
       'autoprefixer',
       'watch'
     ]);
@@ -419,7 +442,13 @@ module.exports = function (grunt) {
     'karma'
   ]);

-  grunt.registerTask('build', [
+  grunt.registerTask('build-dev', [
+    'clean:twirl',
+    'copy:twirl-dev'
+  ]);
+
+  grunt.registerTask('build-dist', [
+    'clean:twirl',
     'clean:dist',
     'wiredep',
     'useminPrepare',
@@ -432,12 +461,13 @@ module.exports = function (grunt) {
     'cssmin',
     'uglify',
     'filerev',
-    'usemin'
+    'usemin',
+    'copy:twirl-dist'
   ]);

   grunt.registerTask('default', [
     'newer:jshint',
 //    'test',
-    'build'
+    'build-dev'
   ]);
 };
Shiti commented 8 years ago

We dont want to modify the Grunt files