diff --git a/Gruntfile.js b/Gruntfile.js index 7a03657..a0a7089 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -30,33 +30,31 @@ module.exports = function(grunt) { // Configuration to be run (and then tested). ssi: { - options: { - baseDir: 'test/fixtures/html/', - }, + options: {}, default_options: { options: {}, files: [{ expand: true, - cwd: 'test/fixtures', - src: ['html/**/*.html'], - dest: '.tmp/', - ext: '.html', + src: ['html/*'], }], }, custom_options: { options: { cacheDir: '', + }, files: [{ expand: true, cwd: 'test/fixtures', src: ['html/**/*.html'], dest: '.tmp/', - ext: '.html', + }], }, test_default: { - options: {}, + options: { + baseDir: 'test/fixtures/html/', + }, files: [{ expand: true, cwd: 'test/fixtures', diff --git a/html/includes/deep/deeper/level2.inc b/html/includes/deep/deeper/level2.inc deleted file mode 100644 index 1a029d5..0000000 --- a/html/includes/deep/deeper/level2.inc +++ /dev/null @@ -1 +0,0 @@ -Level 2 Include
diff --git a/html/includes/deep/deeper/level3.inc b/html/includes/deep/deeper/level3.inc new file mode 100644 index 0000000..86c8ec6 --- /dev/null +++ b/html/includes/deep/deeper/level3.inc @@ -0,0 +1 @@ + Level 3 \ No newline at end of file diff --git a/html/includes/deep/level2.inc b/html/includes/deep/level2.inc new file mode 100644 index 0000000..aff9988 --- /dev/null +++ b/html/includes/deep/level2.inc @@ -0,0 +1,2 @@ + Level 2 + \ No newline at end of file diff --git a/html/includes/deep/virtual0.inc b/html/includes/deep/virtual0.inc new file mode 100644 index 0000000..8eec6d4 --- /dev/null +++ b/html/includes/deep/virtual0.inc @@ -0,0 +1,2 @@ + Virtual 0 + \ No newline at end of file diff --git a/html/includes/level1.inc b/html/includes/level1.inc new file mode 100644 index 0000000..4a5632c --- /dev/null +++ b/html/includes/level1.inc @@ -0,0 +1,2 @@ +Level 1 + \ No newline at end of file diff --git a/html/level0.inc b/html/level0.inc new file mode 100644 index 0000000..959b1ff --- /dev/null +++ b/html/level0.inc @@ -0,0 +1,2 @@ +Level 0 + \ No newline at end of file diff --git a/html/levels.html b/html/levels.html new file mode 100644 index 0000000..7aa8af5 --- /dev/null +++ b/html/levels.html @@ -0,0 +1,2 @@ +Start File + \ No newline at end of file diff --git a/html/virtual.html b/html/virtual.html new file mode 100644 index 0000000..e27e5d1 --- /dev/null +++ b/html/virtual.html @@ -0,0 +1,2 @@ +Virtual Start + \ No newline at end of file diff --git a/tasks/ssi.js b/tasks/ssi.js index c2d0362..5908564 100644 --- a/tasks/ssi.js +++ b/tasks/ssi.js @@ -25,7 +25,7 @@ module.exports = function(grunt) { cache: false, ext: '.html', encoding: 'utf8', - baseDir: process.cwd(), + baseDir: 'html', }; var options = this.options(defaults); @@ -45,7 +45,7 @@ module.exports = function(grunt) { // Concat specified files. var src = f.src.filter(function(filepath) { // Warn on and remove invalid source files (if nonull was set). - if (!grunt.file.exists(filepath)) { + if (!grunt.file.exists(filepath) || grunt.file.isDir(filepath)) { grunt.log.warn('Source file "' + filepath + '" not found.'); return false; } else { @@ -53,9 +53,11 @@ module.exports = function(grunt) { } }).forEach(function(filepath) { + grunt.log.writeln('File to process: ' + f.src + ' - ' + filepath + ' dest: ' + f.dest); + var data = ssi.processFile(filepath, options.cache); - var dest = f.dest; // + path.sep + path.basename(filepath, path.extname(filepath)) + options.ext; + var dest = f.dest ? f.dest : path.join('output', filepath); // + path.sep + path.basename(filepath, path.extname(filepath)) + options.ext; grunt.file.write(dest, data); grunt.log.writeln('File "' + dest + '" created.');