javascript - Grunt read .json file to concat list of html files -
i’m trying grunt concat .css files 2 different directories single css file
i got working ok , trying write similar piece of code concat html files in order specify in simple external .json file rather editing grunfile.js directly each time keeps throwing errors
the file locations , permissions ok, can php or concat css files ok, i’m not great on js syntax os using functions. learned use grunt in last few days pretty sure have not called file correct code??
any advice kindly appreciated!
this gruntfile.js exactly
module.exports = function(grunt) { // 1. configuration goes here grunt.initconfig({ pkg: grunt.file.readjson('package.json'), concat: { // 2. configuration concatinating files goes here file.readjson(‘html-files.json’); }, watch: { files: ['../../pages/**/*.html’], tasks: ['concat'], options : { nospawn : true } } }); // 3. tell grunt plan use plug-in grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-contrib-concat'); // 4. tell grunt when type "grunt" terminal. grunt.registertask('default', ['concat']); };
this html-files.json file contents exactly
html: { src: [ '../../pages/**/this-block.html', '../../pages/**/that-block.html', ], dest: '../../somepage/content.html', }
Comments
Post a Comment