Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Preserves 'ng-if' attribute in link element for CSS. Needs to be expn… #560

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ var getBlocks = function (content) {
last.media = media[1];
}

var ngif = l.match(/ng-if=\"([^\"]+)(\")+/);
// FIXME: ng attribute should be present for all members of the block *and* having the same value
if (ngif) {
last.ngif = ngif[1];
}

// preserve defer attribute
var defer = / defer/.test(l);
if (defer && last.defer === false || last.defer && !defer) {
Expand Down
3 changes: 2 additions & 1 deletion lib/fileprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ var _defaultPatterns = {
var defaultBlockReplacements = {
css: function (block) {
var media = block.media ? ' media="' + block.media + '"' : '';
return '<link rel="stylesheet" href="' + block.dest + '"' + media + '>';
var ngif = block.ngif ? ' ng-if="' + block.ngif + '"' : '';
return '<link rel="stylesheet" href="' + block.dest + '"' + media + ngif + '>';
},
js: function (block) {
var defer = block.defer ? 'defer ' : '';
Expand Down