Skip to content

Commit 319c4f7

Browse files
committed
First release
based on [rework-import](https://github.com/reworkcss/rework-import) v1.2.0 (mainly for fixtures)
0 parents  commit 319c4f7

35 files changed

+773
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 2
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
test/fixtures/*.actual.css

.jscsrc

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"excludeFiles": [
3+
"node_modules/**"
4+
],
5+
"fileExtensions": [
6+
".js"
7+
],
8+
"requireCurlyBraces": [
9+
"if",
10+
"else",
11+
"for",
12+
"while",
13+
"do",
14+
"try",
15+
"catch"
16+
],
17+
"requireSpaceAfterKeywords": [
18+
"if",
19+
"else",
20+
"for",
21+
"while",
22+
"do",
23+
"switch",
24+
"return",
25+
"try",
26+
"catch"
27+
],
28+
"requireSpaceBeforeBlockStatements": true,
29+
"requireParenthesesAroundIIFE": true,
30+
"requireSpacesInConditionalExpression": {
31+
"afterTest": true,
32+
"beforeConsequent": true,
33+
"afterConsequent": true,
34+
"beforeAlternate": true
35+
},
36+
"requireSpacesInFunctionExpression": {
37+
"beforeOpeningCurlyBrace": true
38+
},
39+
"disallowSpacesInFunctionExpression": {
40+
"beforeOpeningRoundBrace": true
41+
},
42+
"disallowMultipleVarDecl": true,
43+
"requireBlocksOnNewline": 1,
44+
"disallowPaddingNewlinesInBlocks": true,
45+
"disallowEmptyBlocks": true,
46+
"disallowSpacesInsideObjectBrackets": true,
47+
"disallowSpacesInsideArrayBrackets": true,
48+
"disallowSpacesInsideParentheses": true,
49+
"disallowQuotedKeysInObjects": "allButReserved",
50+
"disallowSpaceAfterObjectKeys": true,
51+
"requireCommaBeforeLineBreak": true,
52+
"requireOperatorBeforeLineBreak": [
53+
"?",
54+
"+",
55+
"-",
56+
"/",
57+
"*",
58+
"=",
59+
"==",
60+
"===",
61+
"!=",
62+
"!==",
63+
">",
64+
">=",
65+
"<",
66+
"<="
67+
],
68+
"disallowSpaceAfterPrefixUnaryOperators": [
69+
"++",
70+
"--",
71+
"+",
72+
"-",
73+
"~",
74+
"!"
75+
],
76+
"disallowSpaceBeforePostfixUnaryOperators": [
77+
"++",
78+
"--"
79+
],
80+
"requireSpaceBeforeBinaryOperators": [
81+
"+",
82+
"-",
83+
"/",
84+
"*",
85+
"=",
86+
"==",
87+
"===",
88+
"!=",
89+
"!=="
90+
],
91+
"requireSpaceAfterBinaryOperators": [
92+
"+",
93+
"-",
94+
"/",
95+
"*",
96+
"=",
97+
"==",
98+
"===",
99+
"!=",
100+
"!=="
101+
],
102+
"disallowImplicitTypeConversion": [
103+
"numeric",
104+
"boolean",
105+
"binary",
106+
"string"
107+
],
108+
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
109+
"disallowKeywords": [
110+
"with"
111+
],
112+
"disallowMultipleLineStrings": true,
113+
"validateQuoteMarks": "\"",
114+
"validateIndentation": 2,
115+
"disallowMixedSpacesAndTabs": true,
116+
"disallowTrailingWhitespace": true,
117+
"requireKeywordsOnNewLine": [
118+
"else"
119+
],
120+
"requireLineFeedAtFileEnd": true,
121+
"requireCapitalizedConstructors": true,
122+
"safeContextKeyword": "that",
123+
"requireDotNotation": true,
124+
"validateJSDoc": {
125+
"checkParamNames": true,
126+
"checkRedundantParams": true,
127+
"requireParamTypes": true
128+
},
129+
"requireSpaceAfterLineComment": true
130+
}

.jshintrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"newcap": false,
3+
"undef": true,
4+
"unused": true,
5+
"asi": true,
6+
"esnext": true,
7+
"node": true,
8+
"browser": true
9+
}

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
language: node_js

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 1.0.0 - 2014-08-10
2+
3+
First release based on [rework-import](https://github.com/reworkcss/rework-import) v1.2.0 (mainly for fixtures)

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 "MoOx" Maxime Thirouin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# postcss-import [![Build Status](https://travis-ci.org/postcss/postcss-import.png)](https://travis-ci.org/postcss/postcss-import)
2+
3+
A [PostCSS](https://github.com/postcss/postcss) plugin to import stylesheets using `@import` and an optional media query.
4+
5+
## Installation
6+
7+
```bash
8+
npm install postcss-import
9+
```
10+
11+
## Usage
12+
13+
14+
```js
15+
var postcss = require("postcss")
16+
var atImport = require("postcss-import")
17+
18+
var css = postcss()
19+
.use(atImport())
20+
.process(cssString)
21+
.css
22+
```
23+
24+
```css
25+
@import "foo.css";
26+
27+
@import "bar.css" (min-width: 25em);
28+
29+
body {
30+
background: black;
31+
}
32+
```
33+
34+
yields:
35+
36+
```css
37+
/* ... content of foo.css */
38+
39+
@media (min-width: 25em) {
40+
/* ... content of bar.css */
41+
}
42+
43+
body {
44+
background: black;
45+
}
46+
```
47+
48+
### Options
49+
50+
#### encoding
51+
52+
Type: `String`
53+
Default: `utf8`
54+
55+
Use if your CSS is encoded in anything other than UTF-8.
56+
57+
#### path
58+
59+
Type: `String|Array`
60+
Default: `process.cwd()` or _dirname of [the rework source](https://github.com/reworkcss/css#cssparsecode-options)_
61+
62+
A string or an array of paths in where to look for files.
63+
_Note: nested `@import` will additionally benefit of the relative dirname of imported files._
64+
65+
#### transform
66+
67+
Type: `Function`
68+
Default: `null`
69+
70+
A function to transform the content of imported files. Take one argument (file content) & should return the modified content.
71+
72+
#### Example with some options
73+
74+
```js
75+
var postcss = require("postcss")
76+
var atImport = require("postcss-import")
77+
78+
var css = postcss()
79+
.use(atImport({
80+
path: [
81+
"node_modules",
82+
]
83+
transform: require("css-whitespace")
84+
}))
85+
.process(cssString)
86+
.css
87+
```
88+
89+
90+
See [tests](test) for examples.
91+
92+
93+
---
94+
95+
## Contributing
96+
97+
Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.
98+
99+
```bash
100+
git clone https://github.com/postcss/postcss-import.git
101+
git checkout -b patch-1
102+
npm install
103+
npm test
104+
```
105+
106+
## [Changelog](CHANGELOG.md)
107+
108+
## [License](LICENSE-MIT)

0 commit comments

Comments
 (0)