2.4.3 • Published 4 years ago

cssobj-converter v2.4.3

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

CSSOBJ Converter

Join the chat at https://gitter.im/css-in-js/cssobj Build Status

Convert from normal css/LESS/SASS/SCSS to cssobj.

The online version is below:

http://convertcssobj-futurist.rhcloud.com/

( Currently using OpenShift free hosting for nodejs backend, it will sleep for some idle time.

If you cannot open the page, try again after few seconds, it will wake up.

Someone can help with this? Or provide a node js hosting? )

CLI

Install

npm install -g cssobj-converter

Usage

cssobj [option] [cssfile]

Option

optionshortdescription
--output-ooutput file name(.js file)
--pretty-ppretty format output js object default: true
--css-ccss code from command line
--format-fsupported: css,less,js. If js then convert from cssobj into css. default: css
--watch-wwatch dir for changes default: false
--recursive-rrecursive convert all css/less files in dir; default: false
--keepVendor-kkeep vendor prefix for css props
--nameStore-nexport nameStore as classes/ids, and js object as obj

If no cssfile and no -c, then cssobj will read from STDIN.

Example

#read from stdin, (Ctrl+D) to convert
cssobj

#convert abc.css into cssobj, output to stdout
cssobj abc.css

#convert abc.css into cssobj, output to abc.js
cssobj abc.css -o abc.js

#convert abc.js into css then output
cssobj -c '{p:{color: "red"}}' -f js
cssobj abc.js -f js

#convert abc.css into cssobj, output to abc.js, without pretty format
cssobj abc.css -o abc.js -p false

#convert less
cssobj abc.less -f less -o abc.js
cssobj abc.less -o abc.js  #same as above

#convert css in command line
cssobj -c "p{ color:red; }"

# all files in folder convert to .js
cssobj ./abc

# convert all files in folder and watch
cssobj ./abc -w

# convert all files in folder and watch, result as {obj, ids, classes}
cssobj ./abc -wn

NodeJS

Install

npm install -S cssobj-converter

Usage

var converter = require('cssobj-converter')
console.log( converter('p { color: red; }') )

Server

From the lib folder, npm i then run below script:

npm run server

Service URL: http://localhost:8080

Accept POST json data as below:

curl -d '{ "text" : "p {color:red;}" }' localhost:8080
2.4.3

4 years ago

2.4.2

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.3

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.3

6 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.6

7 years ago

2.1.4

7 years ago

2.1.3

8 years ago

2.1.2

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.0

8 years ago