Comparing version 0.1.3 to 0.1.4
@@ -104,2 +104,6 @@ /** | ||
var isComment = function (str) { | ||
return str && str.slice(0, 2) === '//'; | ||
}; | ||
var translateScript = function (str) { | ||
@@ -165,3 +169,5 @@ str = str.substr(1).trim(); // remove dash character | ||
code = expandShortcuts(code); | ||
if (isScript(code)) { | ||
if (isComment(code)) { | ||
output += ''; | ||
} else if (isScript(code)) { | ||
output += translateScript(code); | ||
@@ -168,0 +174,0 @@ } else { |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"main": "caveman.js", | ||
@@ -18,3 +18,3 @@ "scripts": { | ||
}, | ||
"dependencies": { | ||
"devDependencies": { | ||
"jasmine-node": "1.13.1" | ||
@@ -21,0 +21,0 @@ }, |
@@ -11,3 +11,3 @@ | ||
Caveman's markup language is built using an extensible macro system, which allows for arbitrary script execution, explicit logic, and partials. The library is lightweight (1kb compressed), has no dependencies, adds a single `Caveman` variable to the global namespace, and seems from [initial benchmark tests](#benchmarks) to be very fast, almost as fast as native JS concatenation. | ||
Caveman's markup language is built using an extensible macro system, which allows for arbitrary script execution, explicit logic (instead of the bastardized "logic-less" logic of mustache/etc), and partials. The library is lightweight (1kb compressed), has no dependencies, adds a single `Caveman` variable to the global namespace, and seems from [initial benchmark tests](#benchmarks) to be very fast, almost as fast as native JS concatenation. | ||
@@ -101,2 +101,24 @@ ## Installation | ||
### 3. Server-side Compilation and Rendering | ||
You can also use Caveman for static site generation. Let's assume you have your caveman templates in `./templates` and generated assets in `./public`. Using Grunt and [grunt-caveman](https://github.com/andrewchilds/grunt-caveman), configure your Caveman task like so: | ||
```js | ||
grunt.initConfig({ | ||
caveman: { | ||
compile: { | ||
src: ['templates/*.html'], | ||
render: { | ||
// 'homePage' equates to templates/homePage.html | ||
'homePage': 'public/index.html', | ||
'aboutPage': 'public/about/index.html', | ||
'contactPage': 'public/contact/index.html' | ||
} | ||
} | ||
} | ||
}); | ||
grunt.loadNpmTasks('grunt-caveman'); | ||
``` | ||
## Concepts | ||
@@ -389,3 +411,3 @@ | ||
`with` allows you to scope an object to `d` (or to anything, using `with foo as bar`) within a block. | ||
`with` allows you to scope an object to `d` (or to a named variable using `with foo as bar`) within a block. | ||
@@ -399,7 +421,2 @@ ```html | ||
{{- end }} | ||
<!-- rendered HTML --> | ||
<div>1 x 1 = 1</div> | ||
<div>2 x 2 = 4</div> | ||
<div>3 x 3 = 9</div> | ||
``` | ||
@@ -603,2 +620,2 @@ | ||
MIT. Copyright © 2014 Andrew Childs | ||
MIT. Copyright © 2015 Andrew Childs |
Sorry, the diff of this file is not supported yet
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
45553
0
347
617
1
- Removedjasmine-node@1.13.1
- Removed@xmldom/xmldom@0.8.10(transitive)
- Removedcoffee-script@1.12.7(transitive)
- Removedfileset@0.1.8(transitive)
- Removedgaze@0.3.4(transitive)
- Removedglob@3.2.11(transitive)
- Removedgrowl@1.7.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjasmine-growl-reporter@0.0.3(transitive)
- Removedjasmine-node@1.13.1(transitive)
- Removedjasmine-reporters@2.5.2(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.2.140.3.0(transitive)
- Removedmkdirp@0.3.51.0.4(transitive)
- Removedrequirejs@2.3.7(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedunderscore@1.13.7(transitive)
- Removedwalkdir@0.4.1(transitive)