GithubHelp home page GithubHelp logo

anthrax3 / postcss-nested-props Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jednano/postcss-nested-props

0.0 0.0 0.0 95 KB

PostCSS plugin to unwrap nested properties.

License: MIT License

TypeScript 100.00%

postcss-nested-props's Introduction

postcss-nested-props

NPM version npm license Travis Build Status codecov Dependency Status

npm

PostCSS plugin to unwrap nested properties.

Nested Properties

CSS has quite a few properties that are in “namespaces;” for instance, font-family, font-size, and font-weight are all in the font namespace. In CSS, if you want to set a bunch of properties in the same namespace, you have to type it out each time. This plugin provides a shortcut: just write the namespace once, then nest each of the sub-properties within it. For example:

.funky {
  font: {
    family: fantasy;
    size: 30em;
    weight: bold;
  }
}

is compiled to:

.funky {
  font-family: fantasy;
  font-size: 30em;
  font-weight: bold;
}

The property namespace itself can also have a value. For example:

.funky {
  font: 20px/24px fantasy {
    weight: bold;
  }
}

is compiled to:

.funky {
  font: 20px/24px fantasy;
  font-weight: bold;
}

For nested rules, use the postcss-nested plugin, but make sure to run it after this one.

Installation

$ npm install postcss-nested-props

Usage

JavaScript

postcss([ require('postcss-nested-props') ]);

TypeScript

import * as postcssNestedProps from 'postcss-nested-props';

postcss([ postcssNestedProps ]);

Options

None at this time.

Testing

Run the following command:

$ npm test

This will build scripts, run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.

Watching

For much faster development cycles, run the following commands in 2 separate processes:

$ npm run build:watch

Compiles TypeScript source into the ./dist folder and watches for changes.

$ npm run watch

Runs the tests in the ./dist folder and watches for changes.

postcss-nested-props's People

Contributors

jednano avatar zwerdlds 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.