diff --git a/Makefile b/Makefile deleted file mode 100644 index 76fba283..00000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - node_modules/.bin/istanbul cover node_modules/.bin/_mocha \ - -- -b -R tap tests - -browserfiles: - ./bin/bundle browser/nunjucks - SLIM=1 ./bin/bundle browser/nunjucks-slim diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..643fd4ba --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,27 @@ +# Fix line endings in Windows. (runs before repo cloning) +init: + - git config --global core.autocrlf input + +# Test against these versions of Node.js. +environment: + matrix: + - nodejs_version: "0.11" + - nodejs_version: "0.10" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off diff --git a/package.json b/package.json index 5643e164..7119c150 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "node": "*" }, "scripts": { - "test": "make test" + "test": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -b -R tap tests", + "browserfiles": "./bin/bundle browser/nunjucks; SLIM=1 ./bin/bundle browser/nunjucks-slim" }, "bin": { "nunjucks-precompile": "./bin/precompile" diff --git a/src/compiler.js b/src/compiler.js index 82618d31..e04a5b9d 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -124,7 +124,7 @@ var Compiler = Object.extend({ }, _templateName: function() { - return this.templateName == null? 'undefined' : '"'+this.templateName.replace(/"/g, '\\"')+'"'; + return this.templateName == null? 'undefined' : JSON.stringify(this.templateName); }, _bufferAppend: function(func) { diff --git a/src/precompile.js b/src/precompile.js index b197f782..319b91a6 100644 --- a/src/precompile.js +++ b/src/precompile.js @@ -37,6 +37,27 @@ function precompile(input, opts) { var pathStats = fs.existsSync(input) && fs.statSync(input); var output = ''; + var templates = []; + + function addTemplates(dir) { + var files = fs.readdirSync(dir); + + for(var i=0; i