GithubHelp home page GithubHelp logo

bananacss / bananacss Goto Github PK

View Code? Open in Web Editor NEW
183.0 183.0 16.0 671 KB

:banana: The brazilian CSS preprocessor writen in NodeJS.

Home Page: http://bananacss.github.io/

License: MIT License

JavaScript 99.48% Shell 0.52%
abstractions banana css hacktoberfest hacktoberfest2021 nodejs preprocessor superset

bananacss's Introduction

Banana CSS

🍌 The Brazilian CSS superset.

Build Status Coverage Status Dependency Status devDependency Status npm npm

What is?

  • Syntax abstractions for complex native CSS features.
  • If you can, compile native CSS features like a pre-processor (ex: Custom properties and @import).
  • Provide a simple abstraction for a Semantic Grid System with calc().
  • Extra features (ex: @function).

How it works?

Write your style with banana syntax and compile for pure CSS.

Table of contents


How to install

Verify if you have node and npm installed.

Command Line

$ npm install -g bananacss

Module

$ npm install bananacss --save

Command Line Usage

Compile you .bnn file to .css

$ banana <input_path>

Watch for changes.

$ banana <input_path> -w

Output to dir when passing files.

$ banana <input_path> -o <out_path>

Show the project version.

$ banana --version

Show all available commands.

$ banana --help

The bananafile

Create a file called bananafile.json in the directory where you will run the command $ banana and configure as need.

{
	"bnnSize" : true,
	"bnnPosition" : true,
	"bnnGradient" : true,
	"bnnVariable" : true,
	"bnnImport" : true,
	"bnnAlign" : true,
	"bnnWidth" : true,
	"bnnHeight" : true,
	"bnnCol" : true,
	"bnnRow" : true,
	"bnnBox" : true,
	"bnnFunction" : true,
	"compress" : false
}

All features have true as default value, except the compress.


Module Usage

const inputBananaCode = '.a {bnn-size: 50px;}';

// Features injection
const config = {};
config.bnnSize = true;
config.bnnPosition = true;
config.bnnGradient = true;
config.bnnVariable = true;
config.bnnImport = true;
config.bnnAlign = true;
config.bnnWidth = true;
config.bnnHeight = true;
config.bnnCol = true;
config.bnnRow = true;
config.bnnBox = true;
config.bnnFunction = true;
config.compress = true;

const Banana = require('banana')(config);

// Output the css
const output = Banana.render(inputBananaCode);

console.log(output); // .a {width: 50px; height: 50px;}

Features

View all features docs here.


Example

Simple example


Development

Code Style

Follow the Banana NodeJS style guide.

Validate the code style with ESLint:

$ npm run eslint

Code Docs

Generate code docs with JSDocs

$ npm run jsdocs

View code docs in out/index.html

Tests

Run the unit tests with mocha:

$ npm test

Calculate the coverage with Istanbul:

$ npm run cover

Versioning

To keep better organization of releases we follow the Semantic Versioning 2.0.0 guidelines.

Contributing

Find on our issues the next steps of the project ;)
Want to contribute? Follow these recommendations.

History

See Releases for detailed changelog.

License

MIT License © Afonso Pacifer

bananacss's People

Contributors

afonsopacifer avatar lai32290 avatar sabrinabarros avatar suissa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bananacss's Issues

why the name "bananacss"

i was in your talk on riodevday and i met the project, i saw a project now and decided to use bananacss but before i asked myself the following question, why do you put the name "bananacss" ?

1º Banana hangout

1º Banana hangout

minions-funny-gif-GiNyo8KD5j9mM

Participantes:

O que rolou:

Apresentação dos objetivos do projeto e primeiras features.

Objetivo:

Colher feedbacks e gerar ideias.

Novas features sugeridas:

Grid:

Banana code:

.row {
    bnn-width: 900px;
    bnn-position: center;
    bnn-align: left top;
}

.column {
    bnn-col: 4 12 2px; /* cols | total of cols | margins */
}

CSS result

.row {
    width: 100%;
    max-width: 900px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
}

.column {
    margin-right: 2px;
    margin-left: 2px;
    width: x%; /*  x = ((100% * 4) / 12) - (2px * 2) */
}

Box model:

Banana code:

.* {
    bnn-box: default;
    bnn-box: content;
}

CSS result

.* {
    box-sizing: border-box;
    box-sizing: content-box;    
}

Transform:

Banana code:

.element {
    bnn-x: 200px;
    bnn-y: 150px;
    bnn-scale: 50%;
    bnn-rotate: 45deg;
}

CSS result

.element {
    transform: translateX(200px) translateY(150px) scale(.5) rotate(45deg);
}

ES6/ES7 (support)

What do you think about include babel to enable all features of ES6/ES7?

bananaconfig.json

Enable or disable the module features with a json file.

bananaconfig.json

{
    "bnnSize" : "true",
    "bnnPosition" : "true",
    "bnnGradient" : "true",
    "bnnVariable" : "true",
    "bnnImport" : "true",
    "bnnAlign" : "true",
    "bnnWidth" : "true",
    "bnnHeight" : "true"
}

Create bnn-width and bnn-height

bnn-width: 300px;

Compile to:

width: 100%;
max-width: 300px;

bnn-height: 300px;

Compile to:

width: 100%;
max-height: 300px;

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.