Issue #344 : include piskel-boot in index.html

This commit is contained in:
juliandescottes 2015-11-30 13:36:27 +01:00 committed by jdescottes
parent 2b28577813
commit 7d5259acd7
2 changed files with 10 additions and 22 deletions

View file

@ -190,32 +190,20 @@ module.exports = function(grunt) {
includereplace: { includereplace: {
all: { all: {
src: 'src/index.html', src: 'src/index.html',
dest: 'dest-tmp/index.html' dest: 'dest-tmp/index.html',
options : {
globals : {
'version' : version
}
}
} }
}, },
replace: { 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 // main-partial.html is used when embedded in piskelapp.com
mainPartial: { mainPartial: {
options: { options: {
patterns: [{ patterns: [{
match: /piskel-boot.js/g,
replacement: "../piskel-boot"+version+".js"
},{
match: /^(.|[\r\n])*<!--body-main-start-->/, match: /^(.|[\r\n])*<!--body-main-start-->/,
replacement: "", replacement: "",
description : "Remove everything before body-main-start comment" description : "Remove everything before body-main-start comment"
@ -253,7 +241,6 @@ module.exports = function(grunt) {
files: [ files: [
// in dev copy everything to dest-dev // in dev copy everything to dest-dev
{src: ['dest-tmp/index.html'], dest: 'dest-dev/index.html'}, {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-script-list.js'], dest: 'dest-dev/piskel-script-list.js'},
{src: ['src/piskel-style-list.js'], dest: 'dest-dev/piskel-style-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: true, src: ['js/**'], cwd: 'src/', dest: 'dest-dev/', filter: 'isFile'},
@ -322,8 +309,7 @@ module.exports = function(grunt) {
grunt.registerTask('build-index.html', ['includereplace']); grunt.registerTask('build-index.html', ['includereplace']);
grunt.registerTask('merge-statics', ['concat:js', 'concat:css', 'uglify']); 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', 'copy:prod']);
grunt.registerTask('build', ['clean:prod', 'sprite', 'merge-statics', 'build-index.html', 'replace-all', 'copy:prod']);
grunt.registerTask('build-dev', ['clean:dev', 'sprite', 'build-index.html', 'copy:dev']); grunt.registerTask('build-dev', ['clean:dev', 'sprite', 'build-index.html', 'copy:dev']);
// Validate & Build // Validate & Build

View file

@ -102,7 +102,9 @@
@@include('templates/settings/import.html', {}) @@include('templates/settings/import.html', {})
@@include('templates/settings/export.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--> <!--body-main-end-->
<!-- the comment above indicates the end of the markup reused by the editor integrated in piskelapp.com --> <!-- the comment above indicates the end of the markup reused by the editor integrated in piskelapp.com -->
<!-- do not delete, do not move :) --> <!-- do not delete, do not move :) -->