mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
32 lines
786 B
CoffeeScript
32 lines
786 B
CoffeeScript
Declaration = require('./declaration')
|
|
Container = require('./container')
|
|
Comment = require('./comment')
|
|
AtRule = require('./at-rule')
|
|
Result = require('./result')
|
|
Rule = require('./rule')
|
|
|
|
# Root of CSS
|
|
class Root extends Container.WithRules
|
|
constructor: ->
|
|
@type = 'root'
|
|
@rules = []
|
|
super
|
|
|
|
# Fix spaces on insert before first rule
|
|
normalize: (child, sample, type) ->
|
|
child = super
|
|
if type == 'prepend'
|
|
sample.before = if @rules.length > 1 then @rules[1].before else @after
|
|
child
|
|
|
|
# Stringify styles
|
|
stringify: (builder) ->
|
|
@stringifyContent(builder)
|
|
builder(@after) if @after
|
|
|
|
# Generate processing result with optional source map
|
|
toResult: (opts = { }) ->
|
|
new Result(this, opts)
|
|
|
|
module.exports = Root
|