diff --git a/Gruntfile.js b/Gruntfile.js index fd50976b..4d4af130 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -290,6 +290,20 @@ module.exports = function(grunt) { html: ['<%= dir.build %>/**/*.hbs'] }, + /** + * Replace html assets path to Ghost handlebars {{assets}} helper + */ + replace: { + build: { + src: ['<%= dir.build %>/**/*.hbs'], + overwrite: true, + replacements: [{ + from: /[\"\']\/assets\/(.*?)[\"\']/gi, + to: '"{{asset \'$1\'}}"' + }] + } + }, + /** * Copy all files to build/release folder */ @@ -397,6 +411,7 @@ module.exports = function(grunt) { 'rev', 'copy:build', 'usemin', + 'replace:build', 'imagemin:build', 'svgmin:build', 'autoprefixer:build', diff --git a/package.json b/package.json index 451114ee..13e83ab2 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "grunt-usemin": "~2.0.0", "grunt-push-release": "~0.1.1", "grunt-conventional-changelog": "~1.0.0", - "grunt-csso": "~0.5.0" + "grunt-csso": "~0.5.0", + "grunt-text-replace": "~0.3.11" }, "engines": { "node": ">=0.10.0"