bline / jade-html-loader

webpack loader for jade to html
MIT License
30 stars 27 forks source link

Update to pug #19

Open TimothyGu opened 8 years ago

TimothyGu commented 8 years ago

Jade has been renamed to Pug, and it's appropriate for this module to depend on Pug instead of Jade now.

I also volunteer to maintain this under the umbrella of @pugjs, as we now do for pug-loader.

iboozyvoozy commented 8 years ago

Here is another loader pug-html-loader, but it works differently

For example, chaining like ng-cache!pug-html doesn't works with Willyelm's loader, but with this loader all is ok:

{
    test: /\.pug$/,
    loader: 'ng-cache!jade-html'
}

Need only remove jade from peerDependencies

ifokeev commented 8 years ago

@iboozyvoozy you can use pug-html with ngtemplate. pug-html returns module.exports = "your_html" but not the HTML string itself.

ngtemplate has:

    if (content.match(/^module\.exports/)) {
        var firstQuote = findQuote(content, false);
        var secondQuote = findQuote(content, true);
        html = content.substr(firstQuote, secondQuote - firstQuote + 1);
    } else {
        html = content;
    }

but ng-cache hasn't and accepts html only because of:

    try {
        source = htmlMinifier.minify(source, extend({}, opts));
    } catch (e) {
        this.emitWarning(e.toString() + '\nUsing unminified HTML');
    }

Takes for me about 2 hours to understand what the problem.