diff --git a/.travis.yml b/.travis.yml index 0ce3be2..568f32a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,9 @@ language: node_js node_js: - "0.10" before_script: - - npm install -g grunt-cli \ No newline at end of file + - npm install -g grunt-cli +notifications: + email: + - adam@revolutionarysystems.co.uk + - andrew@revolutionarysystems.co.uk + - ci@revolutionarysystems.co.uk \ No newline at end of file diff --git a/README.md b/README.md index 607a4da..29e445d 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ This plugin requires Grunt `~0.4.1` If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: ```shell -npm install grunt-swig --save-dev +npm install grunt-swig-revsys --save-dev ``` One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: ```js -grunt.loadNpmTasks('grunt-swig'); +grunt.loadNpmTasks('grunt-swig-revsys'); ``` ## The "swig" task diff --git a/package.json b/package.json index 66816bf..80868fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "grunt-swig", - "version": "0.2.1", + "name": "grunt-swig-revsys", + "version": "0.3.0", "description": "Static site compiler built around swig", "repository": { "type": "git", diff --git a/tasks/swig.js b/tasks/swig.js index bce763b..26e8fcc 100644 --- a/tasks/swig.js +++ b/tasks/swig.js @@ -28,15 +28,19 @@ module.exports = function(grunt) { } this.filesSrc.forEach(function(file) { + var cwd = globalVars.cwd || ""; + var relativePath = file; + file = cwd + file; if (!grunt.file.exists(file)) { - grunt.log.warn('Source file "' + file.src + '" not found.'); - + grunt.log.warn('Source file "' + file + '" not found.'); return false; } else { - var dirName = path.dirname(file).split('/'), - destPath = dirName.splice(1, dirName.length).join('/'), - outputFile = path.basename(file, '.swig'), - htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + '.html', + var ext = config.data.ext; + if(!ext){ext = path.extname(file);} + var dirName = path.dirname(relativePath).split('/'), + destPath = dirName.splice(0, dirName.length).join('/'), + outputFile = path.basename(file, path.extname(file)), + htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + ext, tplVars = {}, contextVars = {};