Giter VIP home page Giter VIP logo

swordcss's Introduction

SwordCSS

A powerful CSS compiler

Build Status Coverage Status Maintainability Percentage Total alerts Language grade: JavaScript npm version

What Does This Add?

  • An easier systems for combining the styles of classes, ids, and other queries
  • The equivalent of SCSS variables, constants that can be used throughout your CSS
  • An easier way to write CSS variables

And all of that is added through valid CSS syntax!

Installation

$ npm install swordcss
# Or use Yarn
$ yarn add swordcss

Usage

const SwordCSS = require("swordcss");

const sword = SwordCSS();

sword.compile(
  ".allElem {width: 100%; height: 100%;} #elem {sw-class: allElem;}"
); // .allElem {width: 100%; height: 100%;} #elem {width: 100%; height: 100%;}

Options

{
  "useClass": true,
  "useConstant": true,
  "useId": true,
  "useQuery": true,
  "useVariable": true,
  "minify": false
}

These options are used when you initialize the SwordCSS instance.

Documentation

You can check out the documentation for this project here.

Contributing

Code Style

The code style is enforced through ESLint with the SwordCSS ESLint Config and prettier with no config.

Validate code with ESLint

$ npm run lint

Format code with prettier

$ npm run prettier
# or you can use format
$ npm run format

Tests

Tests use mocha for test running and chai for assertions. We also use nyc with Instanbul to calculate code coverage.

Run tests with mocha

$ npm test

Typescript

We use Typescript and JSDoc for static typing of our project without build tooling.

Check types

$ npm run types

Rollup Bundling

We use Rollup to bundle our code into ESM and CJS before being uploaded to NPM.

Bundle code

$ npm run build

Supporters

Stargazers repo roster for @swordcss/swordcss

Forkers repo roster for @swordcss/swordcss

swordcss's People

Contributors

audiodude avatar cdterry87 avatar shadowtime2000 avatar soub4i avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

swordcss's Issues

Load Core Rules Only Once

Currently, the system loads each core file on every rule which isn't that good for performance. A change to load them each once and then use them all on every rule would be preferred.

Fix Option System

We need someone to fix the options system. Currently, options do not do anything and I think this should be changed.

Add Minify Option

Add a minify option which is used when stringifying the CSS AST to minify it.

Allow Multiple Values With Constants

Currently if you input this:

@sw-constants {
  const1: 30px;
}
#elem {
  width: calc(const1 * 20);
}

It would output

#elem {
  width: 30px;
}

when it should be outputting:

#elem {
  width: calc(30px * 20);
}

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.