Skip to content

Commit e809b04

Browse files
author
Nicolas Gallagher
committed
Add support for @host
1 parent b7bf89a commit e809b04

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

History.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99

1010
* add source map generation
1111

12-
1.3.2 / 2013-10-18
12+
1.3.2 / 2013-10-18
1313
==================
1414

1515
* fix whitespace and indentation in the Compressed compiler.
1616
* add @namespace support
1717
* add .stylesheet(node)
1818

19-
1.3.1 / 2013-06-02
19+
1.3.1 / 2013-06-02
2020
==================
2121

2222
* fix output of rules with no declarations for Identity compiler
2323
* fix defaulting of options
2424

25-
1.3.0 / 2013-05-28
25+
1.3.0 / 2013-05-28
2626
==================
2727

2828
* add ignoring of empty rulesets. Closes #7
@@ -33,38 +33,38 @@
3333
* fix trailing ; with comments within rules
3434
* fix comment indentation
3535

36-
1.2.0 / 2013-05-21
36+
1.2.0 / 2013-05-21
3737
==================
3838

3939
* add @document compilation. Closes #82
4040

41-
1.1.0 / 2013-03-19
41+
1.1.0 / 2013-03-19
4242
==================
4343

4444
* add omission of comments when compressed
4545
* add comment support
4646

47-
1.0.5 / 2013-03-15
47+
1.0.5 / 2013-03-15
4848
==================
4949

5050
* fix indentation of multiple selectors in @media. Closes #11
5151

52-
1.0.4 / 2012-11-15
52+
1.0.4 / 2012-11-15
5353
==================
5454

5555
* fix indentation
5656

57-
1.0.3 / 2012-09-04
57+
1.0.3 / 2012-09-04
5858
==================
5959

6060
* add __@charset__ support [rstacruz]
6161

62-
1.0.2 / 2012-09-01
62+
1.0.2 / 2012-09-01
6363
==================
6464

6565
* add component support
6666

67-
1.0.1 / 2012-07-26
67+
1.0.1 / 2012-07-26
6868
==================
6969

7070
* add "selectors" array support

lib/compress.js

+11
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ Compiler.prototype['font-face'] = function(node){
155155
+ this.emit('}');
156156
};
157157

158+
/**
159+
* Visit host node.
160+
*/
161+
162+
Compiler.prototype.host = function(node){
163+
return this.emit('@host', node.position, true)
164+
+ this.emit('{')
165+
+ this.mapVisit(node.rules)
166+
+ this.emit('}');
167+
};
168+
158169
/**
159170
* Visit rule node.
160171
*/

lib/identity.js

+15
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,21 @@ Compiler.prototype['font-face'] = function(node){
187187
+ this.emit('\n}');
188188
};
189189

190+
/**
191+
* Visit host node.
192+
*/
193+
194+
Compiler.prototype.host = function(node){
195+
return this.emit('@host', node.position, true)
196+
+ this.emit(
197+
' {\n'
198+
+ this.indent(1))
199+
+ this.mapVisit(node.rules, '\n\n')
200+
+ this.emit(
201+
this.indent(-1)
202+
+ '\n}');
203+
};
204+
190205
/**
191206
* Visit rule node.
192207
*/

test/cases/host.compressed.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@host{:scope{display:block;}}

test/cases/host.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@host {
2+
:scope {
3+
display: block;
4+
}
5+
}

0 commit comments

Comments
 (0)