Skip to content

Commit

Permalink
Added additional sandboxing function to account for styles applied to…
Browse files Browse the repository at this point in the history
… html and body.
  • Loading branch information
RyanHavoc committed Jan 20, 2017
1 parent 32e4788 commit 895540b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
12 changes: 11 additions & 1 deletion _template/app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,17 @@ var Astrum = new Vue({
output;

output = postcss().use(prefixer({
prefix: '.ndpl-component__sample'
prefix: '.ndpl-component__sample',

transform: function (prefix, selector, prefixedSelector) {
if (selector === 'html') {
return prefix + ' .html';
} else if (selector === 'body') {
return prefix + ' .body';
} else {
return prefixedSelector;
}
}
})).process(_this.styles).css;

// Inject inline styles for Astrum theme override.
Expand Down
4 changes: 2 additions & 2 deletions _template/app/js/main.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions _template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,11 @@ <h3 class="ndpl-component__title">{{ component.title }}</h3>
'ndpl-component__sample--disabled-code': component.options.disable_code_sample
}"
:style="inline_styles"
v-if="component.html"
v-html="component.html">
v-if="component.html">
<div class="html">
<div class="body" v-html="component.html">
</div>
</div>
</div>

<template v-if="component.html">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astrum",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"description": "A lightweight pattern library designed to be included with any web project.",
"main": "./manager/astrum.js",
"scripts": {
Expand Down

0 comments on commit 895540b

Please sign in to comment.