Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-swig-it

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-swig-it - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "grunt-swig-it",
"description": "Create static HTML files using Swig",
"version": "0.0.2",
"version": "0.0.3",
"homepage": "https://github.com/adamsilver/grunt-swig-it",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -28,13 +28,17 @@ # grunt-swig-it

swig_it: {
development: {
init: {
dev: {
options: {
swigDefaults: {
allowErrors: false,
autoescape: true
},
test: {
var: 'short path file'
},
dest: "dest",
src: ['src/swig/**/*.html']
}
data: {
foo: {
bar: 'yeah'
}
}
},
src: ['test/fixtures/**/*.html'],
dest: "test/dest"
}
}

@@ -44,6 +48,12 @@ });

For each template found within src swig-it will look for a json file of the same name to use as data for the template.
The src directory should not include layout files so store 'pages' in a different folder to 'layouts' for your convenience.
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
## Release History
_(Nothing yet)_

@@ -10,2 +10,3 @@ 'use strict';

grunt.registerMultiTask('swig_it', 'swig templater', function(tpl_context) {
var options = this.options();
var config = this;

@@ -15,10 +16,10 @@ var context = tpl_context || '';

if (config.data.init !== undefined) {
swig.setDefaults(config.data.init);
if (options.swigDefaults) {
swig.setDefaults(options.swigDefaults);
}
try {
globalVars = grunt.util._.extend(config.data, grunt.file.readJSON(process.cwd() + '/global.json'));
globalVars = grunt.util._.extend(options.data, grunt.file.readJSON(process.cwd() + '/global.json'));
} catch (err) {
globalVars = grunt.util._.clone(config.data);
globalVars = grunt.util._.clone(options.data);
}

@@ -47,7 +48,7 @@

try {
contextVars = grunt.file.readJSON(path.dirname(file) + '/' + outputFile + "." + context + ".json");
} catch (err) {
contextVars = {};
}
// try {
// contextVars = grunt.file.readJSON(path.dirname(file) + '/' + outputFile + "." + context + ".json");
// } catch (err) {
// contextVars = {};
// }

@@ -54,0 +55,0 @@ tplVars.context = context;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc