grunt-bake
Advanced tools
Comparing version 0.0.11 to 0.1.0
/* | ||
* grunt-bake | ||
* | ||
* | ||
* Copyright (c) 2013 Mathias Paumgarten | ||
@@ -11,4 +10,4 @@ * Licensed under the MIT license. | ||
var parseFunction = function( source, object ) { | ||
return source.replace( /{{([.-\w]*)}}/g, function( match, key ) { | ||
function parseFunction( source ) { | ||
return source.replace( /\{\{([.\-\w]*)\}\}/g, function() { | ||
return ""; | ||
@@ -126,2 +125,20 @@ } ); | ||
watch: { | ||
jshint: { | ||
files: [ | ||
"Gruntfile.js", | ||
"tasks/*.js", | ||
"<%= nodeunit.tests %>", | ||
], | ||
tasks: [ "jshint" ] | ||
}, | ||
test: { | ||
files: [ | ||
"tasks/*.js", | ||
"<%= nodeunit.tests %>", | ||
], | ||
tasks: [ "jshint", "test" ] | ||
} | ||
} | ||
} ); | ||
@@ -131,5 +148,6 @@ | ||
grunt.loadNpmTasks("grunt-contrib-jshint"); | ||
grunt.loadNpmTasks("grunt-contrib-clean"); | ||
grunt.loadNpmTasks("grunt-contrib-nodeunit"); | ||
grunt.loadNpmTasks( "grunt-contrib-jshint" ); | ||
grunt.loadNpmTasks( "grunt-contrib-clean" ); | ||
grunt.loadNpmTasks( "grunt-contrib-nodeunit" ); | ||
grunt.loadNpmTasks( "grunt-contrib-watch" ); | ||
@@ -136,0 +154,0 @@ grunt.registerTask( "test", [ "clean", "bake", "nodeunit" ] ); |
{ | ||
"name": "grunt-bake", | ||
"description": "Bake external includes into files to create static pages with no server-side compilation time", | ||
"version": "0.0.11", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/MathiasPaumgarten/grunt-bake", | ||
@@ -35,2 +35,3 @@ "author": { | ||
"grunt-contrib-nodeunit": "~0.1.2", | ||
"grunt-contrib-watch": "~0.4.3", | ||
"grunt": "~0.4.0" | ||
@@ -37,0 +38,0 @@ }, |
@@ -22,4 +22,4 @@ /* | ||
var defaultProcess = function( template, content ) { | ||
return template.replace( /{{([.-\w]*)}}/g, function( match, key ) { | ||
function defaultProcess( template, content ) { | ||
return template.replace( /\{\{([.\-\w]*)\}\}/g, function( match, key ) { | ||
return resolveName( key, content ); | ||
@@ -49,3 +49,3 @@ } ); | ||
var regex = /([ |\t]*)<!--\(\s?bake\s+([\w\/.-]+)\s?([^>]*)\)-->/g; | ||
var regex = /([ |\t]*)<!\-\-\(\s?bake\s+([\w\/.\-]+)\s?([^>]*)\)\-\->/g; | ||
@@ -60,3 +60,3 @@ | ||
var checkFile = function( src ) { | ||
function checkFile( src ) { | ||
if ( ! grunt.file.exists( src ) ) { | ||
@@ -73,8 +73,8 @@ grunt.log.error( "Source file \"" + src + "\" not fount." ); | ||
var directory = function( path ) { | ||
var directory = path.split( "/" ); | ||
function directory( path ) { | ||
var segments = path.split( "/" ); | ||
directory.pop(); | ||
segments.pop(); | ||
return directory.join( "/" ); | ||
return segments.join( "/" ); | ||
} | ||
@@ -85,3 +85,3 @@ | ||
var parseInlineOptions = function( string ) { | ||
function parseInlineOptions( string ) { | ||
var match; | ||
@@ -100,3 +100,3 @@ var values = {}; | ||
var resolveName = function( name, values ) { | ||
function resolveName( name, values ) { | ||
var names = name.split( "." ); | ||
@@ -123,3 +123,3 @@ var current = values; | ||
var hasValue = function( name, values ) { | ||
function hasValue( name, values ) { | ||
var names = name.split( "." ); | ||
@@ -145,4 +145,6 @@ var current = values; | ||
var applyIndent = function( indent, content ) { | ||
if ( ! indent || indent.length < 1 ) return content; | ||
function applyIndent( indent, content ) { | ||
if ( ! indent || indent.length < 1 ) { | ||
return content; | ||
} | ||
@@ -165,3 +167,3 @@ var lines = content.split( "\n" ); | ||
var parse = function( fileContent, filePath, values ) { | ||
function parse( fileContent, filePath, values ) { | ||
@@ -179,3 +181,5 @@ if ( typeof options.process === "function" ) { | ||
if ( ! hasValue( value, values ) ) return ""; | ||
if ( ! hasValue( value, values ) ) { | ||
return ""; | ||
} | ||
@@ -221,3 +225,2 @@ delete inlineOptions[ "_if" ]; | ||
var dest = file.dest; | ||
var directory; | ||
@@ -224,0 +227,0 @@ checkFile( src ); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23294
362
5