Code Monkey home page Code Monkey logo

c6's Introduction

C6

Hate waiting for SASS compiling your stylesheets with Compass over 10 seconds everytime? C6 helps you write style sheets with efficiency.

C6 is a SASS compatible implementation written in Go. But wait! this is not only to implement SASS, but also to improve the language for better consistency, syntax and performance. And yes, this means we're free to accept new language feature requests.

Build Status Coverage Status GoDoc

wercker status

Setup

Setup GOPATH:

source goenv

Setup dependencies:

source goinstall

Run tests:

go test c6
go test -v c6
go test -v c6/ast

To run specific test

go test -run TestParser -x -v c6

Working in progress

  • Lexing

    • @import
    • simple selector.
      • type selector.
      • child selector.
      • attribute selector.
      • adjacent selector.
      • descendant selector.
      • class selector.
      • ID selector.
    • Ruleset
    • Sub-ruleset
    • Interpolation
    • Property name
    • Property value list
    • Comma-separated list
    • Space-separated list
    • @if , @else , @else if
    • Flags: !default, !important, !optional, !global
    • Hex color
    • Functions
    • Vendor prefix properties
    • MS filter. progid:DXImageTransform.Microsoft....
    • Variable names
    • Variable assignment
    • Time unit support. s second, ms ... etc
    • Angle unit support.
    • Resolution unit support.
    • Unicode Range support: https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-range
    • Media Query
  • Syntax

    • built-in @import-once
  • Built-in Functions

    • .... to be listed
  • Parser

    • Parse @import
    • Parse Expression
    • Parse Space-Sep List
    • Parse Comma-Sep List
    • Parse Map (tests required)
    • Parse Selector
    • Parse Selector with interpolation
    • Parse RuleSet
    • Parse DeclarationBlock
    • Parse Variable Assignment Statement
    • Parse PropertyName
    • Parse PropertyName with interpolation
    • Parse PropertyValue
    • Parse PropertyValue with interpolation
    • Parse conditions
    • Parse Nested RuleSet
    • Parse options: !default, !global, !optional
    • Parse CSS Hack for different browser (support more syntax sugar for this)
    • Parse @font-face block
    • Parse @if statement
    • Parse @mixin statement
    • Parse @include statement
    • Parse @function statement
    • Parse keyword arguments for @function
    • Parse @media statement
    • Parse @switch statement
    • Parse @case statement
    • Parse @use statement
  • SASS Built-in Functions

    • RGB functions
      • rgb($red, $green, $blue)
      • rgba($red, $green, $blue, $alpha)
      • red($color)
      • green($color)
      • blue($color)
      • mix($color1, $color2, [$weight])
    • HSL Functions
      • hsl($hue, $saturation, $lightness)
      • hsla($hue, $saturation, $lightness, $alpha)
      • hue($color)
      • saturation($color)
      • lightness($color)
      • adjust-hue($color, $degrees)
      • lighten($color, $amount)
      • darken($color, $amount)
      • saturate($color, $amount)
      • desaturate($color, $amount)
      • grayscale($color)
      • complement($color)
      • invert($color)
    • Opacity Functions
      • alpha($color) / opacity($color)
      • rgba($color, $alpha)
      • opacify($color, $amount) / fade-in($color, $amount)
      • transparentize($color, $amount) / fade-out($color, $amount)
    • Other Color Functions
      • adjust-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
      • scale-color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])
      • change-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
      • ie-hex-str($color)
    • String Functions
      • unquote($string)
      • quote($string)
      • str-length($string)
      • str-insert($string, $insert, $index)
      • str-index($string, $substring)
      • str-slice($string, $start-at, [$end-at])
      • to-upper-case($string)
      • to-lower-case($string)
    • Number Functions
      • percentage($number)
      • round($number)
      • ceil($number)
      • floor($number)
      • abs($number)
      • min($numbers…)
      • max($numbers…)
      • random([$limit])
    • List Functions
      • length($list)
      • nth($list, $n)
      • set-nth($list, $n, $value)
      • join($list1, $list2, [$separator])
      • append($list1, $val, [$separator])
      • zip($lists…)
      • index($list, $value)
      • list-separator(#list)
    • Map Functions
      • map-get($map, $key)
      • map-merge($map1, $map2)
      • map-remove($map, $keys…)
      • map-keys($map)
      • map-values($map)
      • map-has-key($map, $key)
      • keywords($args)
    • Selector Functions
      • .... to be expanded ...
  • Building AST

    • RuleSet
    • DeclarationBlock
    • PropertyName
    • PropertyValue
    • Comma-Separated List
    • Space-Separated List
    • Basic Expressions
    • FunctionCall
    • Expression with interpolation
    • Variable statements
    • If Condition
    • If Else If, Else Condition
    • Built-in color keyword table
    • Hex Color computation
    • HSL Color computation
    • Number operation: add, sub, mul, div
    • Length operation: number operation for px, pt, em, rem, cm ...etc
    • Expression evaluation
    • Boolean expression evaluation
    • Media Query conditions
  • CodeGen

    • NestedStyleCompiler
      • .... list ast nodes here ....

Reference

SASS Reference http://sass-lang.com/documentation/file.SASS_REFERENCE.html

A feature check list from libsass:

Grammar Ambiguity https://www.facebook.com/cindylinz/posts/10202186527405801?hc_location=ufi

Community

License

MPL License https://www.mozilla.org/MPL/2.0/

(MPL is like LGPL but with static/dynamic linking exception, which allows you to either dynamic/static link this library without permissions)

c6's People

Contributors

c9s avatar waitingkuo avatar yurenju avatar

Watchers

 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.