Skip to content

Commit

Permalink
dev env: automatically remove fake header from desktop builds
Browse files Browse the repository at this point in the history
  • Loading branch information
juliandescottes committed Jul 10, 2016
1 parent 4518f50 commit 0bc7f3b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,20 @@ module.exports = function(grunt) {
// src/index.html should already have been moved by the includereplace task
{src: ['dest/tmp/index.html'], dest: 'dest/prod/piskelapp-partials/main-partial.html'}
]
},
// remove the fake header from the desktop build
desktop: {
options: {
patterns: [{
match: /<!--standalone-start-->(?:.|[\r\n])*<!--standalone-end-->/,
replacement: "",
description : "Remove everything between standalone-start & standalone-end"
}
]
},
files: [
{src: ['dest/prod/index.html'], dest: 'dest/prod/index.html'}
]
}
},

Expand Down Expand Up @@ -314,15 +328,15 @@ module.exports = function(grunt) {

grunt.registerTask('build-index.html', ['includereplace']);
grunt.registerTask('merge-statics', ['concat:js', 'concat:css', 'uglify']);
grunt.registerTask('build', ['clean:prod', 'sprite', 'merge-statics', 'build-index.html', 'replace', 'copy:prod']);
grunt.registerTask('build', ['clean:prod', 'sprite', 'merge-statics', 'build-index.html', 'replace:mainPartial', 'copy:prod']);
grunt.registerTask('build-dev', ['clean:dev', 'sprite', 'build-index.html', 'copy:dev']);

// Validate & Build
grunt.registerTask('default', ['lint', 'build']);

// Build stand alone app with nodewebkit
grunt.registerTask('desktop', ['clean:desktop', 'default', 'nwjs:windows']);
grunt.registerTask('desktop-mac', ['clean:desktop', 'default', 'nwjs:macos']);
grunt.registerTask('desktop', ['clean:desktop', 'default', 'replace:desktop', 'nwjs:windows']);
grunt.registerTask('desktop-mac', ['clean:desktop', 'default', 'replace:desktop', 'nwjs:macos']);

// Start webserver and watch for changes
grunt.registerTask('serve', ['build', 'connect:prod', 'open:prod', 'watch:prod']);
Expand Down
2 changes: 2 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
color:white;">
<span style="top:45%">Loading Piskel ...</span>
</div>
<!--standalone-start-->
@@include('templates/debug-header.html', {})
<!--standalone-end-->

<!-- the comment below indicates the beginning of markup reused by the editor integrated in piskelapp.com -->
<!-- do not delete, do not move :) -->
Expand Down

0 comments on commit 0bc7f3b

Please sign in to comment.