Skip to content

Commit

Permalink
Issue #344 : include piskel-boot in index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
juliandescottes committed Nov 30, 2015
1 parent 4feb4c4 commit 05b8a63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
28 changes: 7 additions & 21 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,32 +190,20 @@ module.exports = function(grunt) {
includereplace: {
all: {
src: 'src/index.html',
dest: 'dest-tmp/index.html'
dest: 'dest-tmp/index.html',
options : {
globals : {
'version' : version
}
}
}
},

replace: {
piskelBoot: {
options: {
patterns: [
{
match: 'version',
replacement: version
}
]
},
files: [
{src: ['src/piskel-boot.js'], dest: 'dest/piskel-boot.js'},
{src: ['src/piskel-boot.js'], dest: 'dest/piskel-boot' + version +'.js'}
]
},
// main-partial.html is used when embedded in piskelapp.com
mainPartial: {
options: {
patterns: [{
match: /piskel-boot.js/g,
replacement: "../piskel-boot"+version+".js"
},{
match: /^(.|[\r\n])*<!--body-main-start-->/,
replacement: "",
description : "Remove everything before body-main-start comment"
Expand Down Expand Up @@ -253,7 +241,6 @@ module.exports = function(grunt) {
files: [
// in dev copy everything to dest-dev
{src: ['dest-tmp/index.html'], dest: 'dest-dev/index.html'},
{src: ['src/piskel-boot.js'], dest: 'dest-dev/piskel-boot.js'},
{src: ['src/piskel-script-list.js'], dest: 'dest-dev/piskel-script-list.js'},
{src: ['src/piskel-style-list.js'], dest: 'dest-dev/piskel-style-list.js'},
{expand: true, src: ['js/**'], cwd: 'src/', dest: 'dest-dev/', filter: 'isFile'},
Expand Down Expand Up @@ -322,8 +309,7 @@ module.exports = function(grunt) {

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

// Validate & Build
Expand Down
4 changes: 3 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
@@include('templates/settings/import.html', {})
@@include('templates/settings/export.html', {})

<script type="text/javascript" src="piskel-boot.js"></script>
<script type="text/javascript">
@@include('piskel-boot.js', {})
</script>
<!--body-main-end-->
<!-- the comment above indicates the end of the markup reused by the editor integrated in piskelapp.com -->
<!-- do not delete, do not move :) -->
Expand Down

0 comments on commit 05b8a63

Please sign in to comment.