Ver código fonte

Revert cli back to what it was while I fix the tests for windows

pull/558/head
kookookchoozeus 10 anos atrás
pai
commit
42fbdc3850
1 arquivos alterados com 3 adições e 30 exclusões
  1. +3
    -30
      bin/mustache

+ 3
- 30
bin/mustache Ver arquivo

@@ -78,13 +78,7 @@ function readPartials (cb) {
var partialPath = partialsPaths.pop(); var partialPath = partialsPaths.pop();
var partial = fs.createReadStream(partialPath); var partial = fs.createReadStream(partialPath);
streamToStr(partial, function onDone (str) { streamToStr(partial, function onDone (str) {

var keysArray = getPartialNames(partialPath);

keysArray.forEach(function addPartialNames (key) {
partials[key] = str;
});

partials[getPartialName(partialPath)] = str;
readPartials(cb); readPartials(cb);
}); });
} }
@@ -137,27 +131,6 @@ function hasVersionArg () {
}); });
} }


function getPartialNames (filename) {

// get path relative to the template file
// in order to use e.g. {{> ../common/footer }}

// before, {{> footer }} used the first -p file with the filename 'footer'
// the second replace is for a consistent form between platforms
// without it, you would have to use {{> ..\\common\\footer }} for windows
// and {{> ../common/footer }} for *nix

// this can be extended to the mustache API by using the relative path as
// the key in the partials object
// e.g. mustache.render(template, view, { '../../common/footer': '...' })
var relativePath = path.
relative(templateArg, filename).
replace('.mustache', '').
replace(/\\{1,2}/g, '/');

return [
path.basename(filename, '.mustache'),
relativePath
];
function getPartialName (filename) {
return path.basename(filename, '.mustache');
} }

Carregando…
Cancelar
Salvar