Created
May 29, 2013 16:19
-
-
Save narqo/5671575 to your computer and use it in GitHub Desktop.
How to redefine something in BEMHTML?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PRJ/[...]/b-page.bemhtml | |
block b-page { | |
default: { | |
var ctx = this.ctx, | |
dtype = apply(this._mode = 'doctype'), | |
buf = [ | |
dtype, | |
{ | |
elem: 'root', | |
content: [ | |
{ | |
elem: 'head', | |
content: [ | |
{ | |
tag: 'meta', | |
attrs: { charset: 'utf-8' } | |
}, | |
{ | |
tag: 'meta', | |
attrs: { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' } // Хочу `edge` и все! | |
}, | |
{ | |
tag: 'title', | |
content: ctx.title | |
}, | |
ctx.favicon ? { | |
elem: 'favicon', | |
url: ctx.favicon | |
} : '', | |
ctx.meta, | |
{ | |
block: 'i-ua' | |
}, | |
ctx.head | |
] | |
}, | |
ctx | |
] | |
} | |
]; | |
applCtxy(buf); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
block b-page, elem head { | |
content: { | |
// TODO: пример переопределения только `__head` | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
block b-page, elem head { | |
this.ctx && this.ctx.tag === 'meta' && this.ctx.attrs && this.ctx.attrs['http-equiv']: { | |
applyCtx({ | |
tag : this.ctx.tag, | |
attrs : { | |
'http-equiv' : 'X-UA-Compatible', | |
content : 'IE=edge' | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment