|
|
|
@ -83,21 +83,34 @@ module.exports = Backbone.Model.extend(Styleable).extend({ |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns CSS string of the rule |
|
|
|
* Get declaration block |
|
|
|
* @param {Object} [opts={}] Options |
|
|
|
* @return {string} |
|
|
|
*/ |
|
|
|
toCSS(opts = {}) { |
|
|
|
getDeclaration(opts = {}) { |
|
|
|
let result = ''; |
|
|
|
const atRule = this.getAtRule(); |
|
|
|
const style = this.styleToString(opts); |
|
|
|
const selectors = this.selectorsToString(); |
|
|
|
const style = this.styleToString(opts); |
|
|
|
const singleAtRule = this.get('singleAtRule'); |
|
|
|
|
|
|
|
if (selectors && style) { |
|
|
|
if ((selectors || singleAtRule) && style) { |
|
|
|
result = singleAtRule ? style : `${selectors}{${style}}`; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns CSS string of the rule |
|
|
|
* @param {Object} [opts={}] Options |
|
|
|
* @return {string} |
|
|
|
*/ |
|
|
|
toCSS(opts = {}) { |
|
|
|
let result = ''; |
|
|
|
const atRule = this.getAtRule(); |
|
|
|
const block = this.getDeclaration(opts); |
|
|
|
block && (result = block); |
|
|
|
|
|
|
|
if (atRule && result) { |
|
|
|
result = `${atRule}{${result}}`; |
|
|
|
} |
|
|
|
|