npm install --save nymag-handlebars
var hbs = require('nymag-handlebars')(),
template = hbs.compile('<h1>Hello {{ place }}!</h1>'),
result = template({ place: 'World' });
// result: <h1>Hello World!</h1>
// sites/selectall/styleguide.css | |
$text-color: #111; | |
$one-column-text-color: #333; | |
$link-color: #111; | |
$sponsored-link-color: #1782a9; | |
$link-border-color: #fcd400; | |
$serif-stack: Georgia, serif; | |
$sans-serif-stack: Arial, sans-serif; |
// sites/selectall/styleguide.css | |
$text-color: #111; | |
$one-column-text-color: #333; | |
$link-color: #111; | |
$sponsored-link-color: #1782a9; | |
$link-border-color: #fcd400; | |
/* -------------------------------------- */ |
/* component styles */ | |
.myComponent-title { | |
color: $myComponent-title--color or red; | |
font-size: $myComponent-title--font-size or 24px; | |
font-weight: $myComponent-title--font-weight or bold; | |
} | |
.myComponent-body { | |
color: $myComponent-body--color or black; | |
font-size: $myComponent-body--font-size or 16px; |
/* component styles */ | |
.myComponent-title { | |
color: red; | |
font-size: 24px; | |
font-weight: bold; | |
} | |
.myComponent-body { | |
color: black; | |
font-size: 16px; |
[ | |
new webpack.DefinePlugin({ | |
'process.env': { | |
NODE_ENV: '"production"' | |
} | |
}), | |
new webpack.optimize.UglifyJsPlugin({ | |
compress: { | |
sequences: true, | |
properties: true, |
function recursivelyCheckReference(urls) { | |
const stream = rest.get(urls) | |
.map((data) => { | |
const childUrls = listComponentReferences(data); // returns an array of urls | |
stream.append(recursivelyCheckReference(childUrls)); | |
return { result: 'success' }; // object I can filter on | |
}).errors((err, push) => { | |
push(null, { result: 'error', url: err.url }); // object I can filter on. I'm adding url to errors thrown from the rest service | |
}); |
// checking references shallowly is easy | |
rest.get(url) | |
.map(() => false) | |
// we don't care about data, but we want the resulting stream's length | |
// to be the number of urls we've checked | |
.errors((err, push) => { | |
push(null, url); // every url that errors out should be captured | |
}); |
// my files service returns a stream of schemas and data | |
// (from a folder of mixed schema- and data-containing files) | |
// each item in the stream is an object with a dynamic key | |
// (in reality it's based on the filename, but this is a simplified example) | |
const files = _([ | |
{ schema1: { foo: 'bar' } }, | |
{ data1: { baz: 'qux' } }, | |
{ data2: { quux: 'quuux' } } | |
]); |
npm install --save nymag-handlebars
var hbs = require('nymag-handlebars')(),
template = hbs.compile('<h1>Hello {{ place }}!</h1>'),
result = template({ place: 'World' });
// result: <h1>Hello World!</h1>