Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding example of using multiple destinations - fixing a bug with fig…

…uring out the source from the file extension
  • Loading branch information...
commit fe793f332611ad6e818f3e042d49124656eb9aef 1 parent 3fa3b81
Brian Woodward doowb authored
10 Gruntfile.js
View
@@ -45,6 +45,7 @@ module.exports = function(grunt) {
assemble: {
options: {
+ assets: 'test/actual',
data: ['test/common/data/common1.json', 'test/common/data/common2.yml']
},
// Run basic tests on templates and data.
@@ -64,6 +65,15 @@ module.exports = function(grunt) {
files: {
'test/actual/yaml': ['test/yaml/*.hbs']
}
+ },
+ multi: {
+ options: {
+ layout: 'test/files/layout.hbs'
+ },
+ files: {
+ 'test/actual/multi/dest1': ['test/files/**/*.hbs', '!test/files/layout*.*'],
+ 'test/actual/multi/dest2': ['test/files/**/*.md']
+ }
}
}
});
6 tasks/assemble.js
View
@@ -41,9 +41,11 @@ module.exports = function(grunt) {
options.partials = mergeOptionsArrays(this.target, 'partials');
// try to get a src to use for configuration
- var src;
+ var src = false;
this.files.forEach(function(fp) {
- src = fp.src;
+ if(!src) {
+ src = fp.src;
+ }
});
if(!src || src.length === 0) {
16 test/actual/multi/dest1/alert.html
View
@@ -0,0 +1,16 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+
+
+<span class="alert alert-info"></span>
+
+ </div>
+ </body>
+</html>
16 test/actual/multi/dest1/complex.html
View
@@ -0,0 +1,16 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+
+
+<span class="alert alert-info">This is an alert</span>
+
+ </div>
+ </body>
+</html>
20 test/actual/multi/dest1/extend.html
View
@@ -0,0 +1,20 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+
+
+
+
+
+
+
+
+ </div>
+ </body>
+</html>
24 test/actual/multi/dest1/helpers.html
View
@@ -0,0 +1,24 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+
+<h2>ul</h2>
+<p> }}</p>
+<h2>link</h2>
+<p><a class="" href="http://gist.github.com/jonschlinkert/5193239" title="helpers.js">helpers.js</a></p>
+<h2>gist</h2>
+<script src="https://gist.github.com/5193239.js"></script>
+
+
+<h2>debug</h2>
+
+
+ </div>
+ </body>
+</html>
16 test/actual/multi/dest1/simple3.html
View
@@ -0,0 +1,16 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+
+
+<span class="alert alert-info">This is an alert</span>
+
+ </div>
+ </body>
+</html>
32 test/actual/multi/dest2/complex1.md.html
View
@@ -0,0 +1,32 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+ ## Some Markdown
+
+ - one
+ - two
+ - three
+
+```javascript
+var foo = function(bar) {
+ console.log(bar);
+};
+```
+
+[Click here](http://www.google.com)
+
+```json
+{
+ "foo": "bar"
+}
+```
+
+ </div>
+ </body>
+</html>
20 test/actual/multi/dest2/simple1.md.html
View
@@ -0,0 +1,20 @@
+<!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>YAML Test</title>
+ <link href="../../bootstrap.css" rel="stylesheet">
+ </head>
+ <body>
+ <div class="container">
+ ## Some Markdown
+
+ - one
+ - two
+ - three
+
+[Click here](http://github.com)
+
+ </div>
+ </body>
+</html>
2  test/files/helpers.hbs
View
@@ -5,7 +5,7 @@ text: helpers.js
{{#markdown}}
## ul
-{{ul 'something'}}
+{{! {{ul 'something'}} }}
## link
4 test/files/layout.hbs
View
@@ -3,10 +3,10 @@
<head>
<meta charset="UTF-8">
<title>{{#if title}}{{title}}{{else}}YAML Test{{/if}}</title>
- <link href="../bootstrap.css" rel="stylesheet">
+ <link href="{{assets}}/bootstrap.css" rel="stylesheet">
</head>
<body>
- <div class="container">
+ <div class="container">
{{> body }}
</div>
</body>
Please sign in to comment.
Something went wrong with that request. Please try again.