Ignore template expression in link href.

This commit is contained in:
Alexandre Gigliotti
2015-12-02 11:40:47 -08:00
parent 897d87436a
commit 22ce5e3f25
3 changed files with 21 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
const co = require('co');
const fs = require('mz/fs');
const isLocalPath = require('is-local-path');
const isTemplateExpression = require('./is-template-expression');
const less = require('less');
const path = require('path');
const R = require('ramda');
@@ -38,7 +39,10 @@ const inlineLess = co.wrap(function * ($, filename, options) {
var files = [];
try {
const links = $('link[rel="stylesheet/less"]')
.filter((index, link) => isLocalPath($(link).attr('href')))
.filter((index, link) => {
const href = $(link).attr('href');
return isLocalPath(href) && !isTemplateExpression(href);
})
.toArray();
const getHref = element => path.resolve(basedir, $(element).attr('href'));
const hrefs = R.map(getHref, links);