Git Product home page Git Product logo

css-aid's Introduction

css-aid

Light, standards focused CSS preprocessor

css-aid doesn't propose any new syntax rules, it just helps with tedious issues that we approach when writing standard CSS. e.g. it expands experimental properties into collection containing all vendor prefixes, or resolves CSS variables syntax so it can be used in browsers that do not support it.

How it works? Currently it's just primitive regular expression based search and replace algorithm. As project may expand it's possible it'll be upgraded to use more syntax bulletproof solution

Installation

$ npm install css-aid

Usage

var cssAid = require('css-aid');
var processedCss = cssAid(plainCSS);

Optionally you can manually decide which rules (see list below) you want to apply:

// Apply only 'border-radius' and 'variables' rules
var processedCss = cssAid(plainCSS, [require('css-aid/rules/border-radius'), require('css-aid/rules/variables')]);

Rules

Following list is still not perceived as complete and is extended on demand

align-self

Replaces: align-self: <value> with: -webkit-align-self: <value>; align-self: <value>

border-radius

Replaces: border-radius: <value> with: -webkit-border-radius: <value>; -moz-border-radius: <value>; -khtml-border-radius: <value>; border-radius: <value>

box-shadow

Replaces: box-shadow: <value> with: -moz-box-shadow: <value>; -webkit-box-shadow: <value>; box-shadow: <value>

box-sizing

Replaces: box-sizing: <value> with: -moz-box-sizing: <value>; -webkit-box-sizing: <value>; box-sizing: <value>

flex-wrap

Replaces: flex-wrap: <value> with: -webkit-flex-wrap: <value>; flex-wrap: <value>

flex

Replaces: display: flex with: display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex

justify-content

Replaces: justify-content: <value> with: -webkit-justify-content: <value>; justify-content: <value>

variables

Supports only variables defined in ::root rule.

e.g. for following code:

::root {
	--foo: rgba(200, 200, 200, 0.5);
--lorem-ipsum: 20px 30px;
}
div.test {
	color: black;
background: var(--foo);
	margin: var(--lorem-ipsum);
}

It will produce:

div.test {
	color: black;
background: rgba(200, 200, 200, 0.5);
	margin: 20px 30px;
}

Tests Build Status

$ npm test

css-aid's People

Contributors

medikoo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.