Browse files

docs etc

  • Loading branch information...
1 parent 32c51c1 commit 9ea8f174e286e4a7610a2241dccc0c1d74de8499 @substack committed Aug 10, 2012
Showing with 119 additions and 3 deletions.
  1. +18 −0 LICENSE
  2. +7 −0 example/small.css
  3. +39 −0 package.json
  4. +55 −3 readme.markdown
View
18 LICENSE
@@ -0,0 +1,18 @@
+This software is released under the MIT license:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
7 example/small.css
@@ -0,0 +1,7 @@
+.title.today {
+ font-weight: bold;
+}
+
+.body {
+ font-size: 14px;
+}
View
39 package.json
@@ -0,0 +1,39 @@
+{
+ "name" : "split-css",
+ "version" : "0.0.0",
+ "description" : "split css files into arrays that you can use to set prefixes",
+ "main" : "index.js",
+ "bin" : {
+ "split-css": "bin/cmd.js"
+ },
+ "directories" : {
+ "example" : "example",
+ "test" : "test"
+ },
+ "dependencies" : {
+ "cssp" : "~1.0.6",
+ "concat-map" : "~0.0.0"
+ },
+ "devDependencies" : {
+ "tap" : "~0.3.0"
+ },
+ "scripts" : {
+ "test" : "tap test/*.js"
+ },
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/substack/split-css.git"
+ },
+ "homepage" : "https://github.com/substack/split-css",
+ "keywords" : [
+ "css",
+ "prefix"
+ ],
+ "author" : {
+ "name" : "James Halliday",
+ "email" : "mail@substack.net",
+ "url" : "http://substack.net"
+ },
+ "license" : "MIT",
+ "engine" : { "node" : ">=0.6" }
+}
View
58 readme.markdown
@@ -1,26 +1,32 @@
# split-css
-Split css files into arrays that you can trivially set prefixes with.
+Split css files into arrays that you can use to set prefixes.
# exposition
By splitting a css file in just the right places:
``` js
-var css = [];
+var css = [".","title.","today {\n font-weight: bold;\n}\n\n.","body {\n font-size: 14px;\n}"]
```
it's possible to set css prefixes with only a single `.join()`:
-```
+``` js
var output = css.join('PREFIX-')
console.log(output);
```
***
```
+.PREFIX-title.PREFIX-today {
+ font-weight: bold;
+}
+.PREFIX-body {
+ font-size: 14px;
+}
```
Having css files split into arrays like this is useful for browser experiments
@@ -29,4 +35,50 @@ to bundle an entire css parser browser-side.
# example
+``` js
+var split = require('../');
+var fs = require('fs');
+
+var src = fs.readFileSync(__dirname + '/style.css', 'utf8');
+var chunks = split(src);
+console.dir(chunks);
+```
+
+***
+
+```
+[ '.',
+ 'body {\n color: green;\n padding: 15px;\n}\n\ndiv#',
+ 'robots .',
+ 'beep.',
+ 'boop {\n text-align: center;\n}\n\n#',
+ 'a.',
+ 'b > .',
+ 'bling.',
+ 'blong {\n margin: auto;\n}\n\na.',
+ 'clickable[href="/x.y.z"]:link, a.',
+ 'clickable[href="/x.y.z"]:visited {\n color: cyan;\n}\n' ]
+```
+
+# methods
+
+``` js
+var split = require('split-css')
+```
+
+## split(src)
+
+Return an array from the source string `src` split at the leading character in
+each id or class definition in the selector rules.
+
+# install
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install split-css
+```
+
+# license
+MIT

0 comments on commit 9ea8f17

Please sign in to comment.