Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

absurd

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

absurd - npm Package Compare versions

Comparing version 0.0.24 to 0.0.26

tests/minify.spec.js

3

index.js

@@ -20,3 +20,4 @@ #!/usr/bin/env node

_defaultOptions = {
combineSelectors: true
combineSelectors: true,
minify: false
};

@@ -23,0 +24,0 @@

@@ -10,3 +10,3 @@ var colors = require('colors'),

var compile = function(absurd, source, output) {
var compile = function(absurd, source, output, options) {
// if there is output provided

@@ -17,3 +17,3 @@ if(output) {

console.log(("> save: " + output).green);
});
}, options);
} else {

@@ -23,3 +23,3 @@ absurd(process.cwd() + "/" + source).compile(function(err, css) {

console.log(("> css: " + css).green);
});
}, options);
}

@@ -56,7 +56,7 @@ }

var eventFired = function(event, filepath) {
var eventFired = function(event, filepath, options) {
fs.stat(filepath, function(err, stats) {
if(stats && stats.isFile()) {
console.log(("> " + event + ": " + filepath).yellow);
compile(absurd, argv.s, argv.o);
compile(absurd, argv.s, argv.o, options);
}

@@ -69,5 +69,6 @@ });

absurd = ab;
var options = { minify: argv.m && argv.m == "true"};
// if there is source provided
if(argv.s) {
compile(absurd, argv.s, argv.o);
compile(absurd, argv.s, argv.o, options);
// if there is watcher provided

@@ -84,3 +85,3 @@ if(argv.w) {

watcher.on('all', function(event, filepath) {
eventFired(event, filepath);
eventFired(event, filepath, options);
});

@@ -87,0 +88,0 @@ })

@@ -0,1 +1,3 @@

var cleanCSS = require('clean-css');
var newline = '\n';

@@ -94,3 +96,8 @@ var toCSS = function(rules) {

}
callback(null, css);
// Minification
if(options.minify) {
callback(null, cleanCSS.process(css));
} else {
callback(null, css);
}
}
{
"name": "absurd",
"version": "0.0.24",
"version": "0.0.26",
"homepage": "https://github.com/krasimir/absurd",

@@ -19,3 +19,4 @@ "description": "CSS preprocessor",

"underscore": "1.5.1",
"css-parse": "1.5.3"
"css-parse": "1.5.3",
"clean-css": "1.1.3"
},

@@ -22,0 +23,0 @@ "keywords": [

@@ -38,4 +38,16 @@ # absurd.js

### Inline styles
### Compilation
compile([callback], [settings])
compileFile([outputFile], [callback], [settings])
*settings* parameter is optional. Valid options:
{
combineSelectors: true | false (by default true),
minify: true | false (by default false)
}
#### Inline
var Absurd = require("absurd");

@@ -46,3 +58,3 @@ Absurd(function(api) {

// do something with the css
});
},);

@@ -59,2 +71,9 @@ Or you may get the API separately.

#### To file
var output = "./css/styles.css";
Absurd("./css/styles.js").compileFile(output, function(err, css) {
// ...
});
### Puting the styles in an external file

@@ -125,9 +144,2 @@

### Compiling to file
var output = "./css/styles.css";
Absurd("./css/styles.js").compileFile(output, function(err, css) {
// ...
});
### Using through command line interface

@@ -145,2 +157,5 @@

// Minify the CSS
absurd -s [source file] -m true
### Using with Grunt

@@ -362,3 +377,3 @@

### Plugins
### Plugins (i.e. define your own CSS properties)

@@ -457,2 +472,35 @@ The plugins are similar like mixins, but act as property-value pair. There is an API method for registering plugins. For example:

### Sending raw data to the final compiled CSS
AbsurdJS gives you ability to directly send content to the final CSS. I.e. something which is skipped by the compiler and it is directly concatenated with the processed data.
api
.add({
body: {
marginTop: "20px",
p: {
fontSize: "5px"
}
}
})
.raw('/* ' + comment + ' */')
.add({
a: {
paddingTop: "20px"
}
});
The code above is compiled to
body {
margin-top: 20px;
}
body p {
font-size: 5px;
}
/* AbsurdJS is awesome! */
a {
padding-top: 20px;
}
## API

@@ -534,2 +582,8 @@

### .raw([string])
module.exports = function(api) {
api.raw('/* comment here */');
}
## Testing

@@ -536,0 +590,0 @@

@@ -11,3 +11,3 @@ module.exports = function(A) {

p: {
'line-height': '32px'
'line-height': '133px'
}

@@ -14,0 +14,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc