Browse Source

allow for multiple at-rules

pull/1036/head
Tom Medema 8 years ago
parent
commit
e728eb8c6e
  1. 9
      src/css_composer/index.js
  2. 1
      test/specs/grapesjs/index.js
  3. 2
      test/specs/parser/model/ParserHtml.js

9
src/css_composer/index.js

@ -182,8 +182,13 @@ module.exports = () => {
var w = width || '';
var opt = { ...opts };
var rule = this.get(selectors, s, w, opt);
if (rule) return rule;
else {
// do not create rules that were found before
// unless this is an at-rule, for which multiple declarations
// make sense (e.g. multiple `@font-type`s)
if (rule && rule.config && !rule.config.atRuleType) {
return rule;
} else {
opt.state = s;
opt.mediaText = w;
opt.selectors = '';

1
test/specs/grapesjs/index.js

@ -166,6 +166,7 @@ describe('GrapesJS', () => {
@font-face {
font-family: 'Glyphicons Halflings';
src: url(https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff2) format('woff2');
}
@font-face {
font-family: 'Droid Sans';
src: url(https://fonts.gstatic.com/s/droidsans/v8/SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2) format('woff2');

2
test/specs/parser/model/ParserHtml.js

@ -372,7 +372,7 @@ module.exports = {
expect(res.css).toEqual(resCss);
});
it.only('Respect multiple font-faces contained in styles in html', () => {
it('Respect multiple font-faces contained in styles in html', () => {
const str = `
<style>
@font-face {

Loading…
Cancel
Save