Coder Social home page Coder Social logo

cef62 / css-modules-compiler Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 0.0 696 KB

Compile CSS Modules to static CSS and remove non-standard code from the JavaScript files

Home Page: https://cef62.github.io/css-modules-compiler/

License: MIT License

CSS 1.48% JavaScript 98.52%

css-modules-compiler's Introduction

Hi there ๐Ÿ‘‹

css-modules-compiler's People

Contributors

cef62 avatar michelebertoli avatar

Stargazers

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

Watchers

 avatar  avatar

css-modules-compiler's Issues

Support blacklisting for css files

Often the source folder contains both local and global css files. The module should be able to ignore css files based on user defined patterns.

For example: ignore all css files matching *.global.
Also should be possible to request to copy without modification all the filtered css.

Cleaner file names

Wouldn't it be better to rename the files in the following way?

src/css-modules-compiler.js => src/compiler.js
src/css-modules-extractor.js => src/extractor.js
src/update-css-modules-imports.js => src/update-imports.js (or just src/updater.js for consistency)
bin/css-module-compiler.js => bin/css-modules-compiler.js

What do you think @cef62?

Make <source> the default param

I was about to start writing the docs for the cli when I realised that we should accept the source folder as the first parameter (without any flag), like:

css-modules-compiler compile <source> [options]

What do you think @cef62?

Remove console.*

We should avoid using console.* and use a proper logger library that gets activated by a verbose or debug flag.

Split the compiler into smaller modules

The compiler is supposed to only compose the submodules but at the moment it has some logic inside and it counts more than 100 lines.
We should split it into smaller (and more testable) submodules.

My idea:

transformer
convertCssMapToAst
convertCssMapToAstMap

utils
updateFilesystem
cleanCss
concatenateCss
copySourceFolder

optimizer
clearJsonMap

Any thoughts @cef62?
More than happy to do it but I want your ok to proceed : )

Remove unused css classes from json map

If a class only composes other classes (without adding any styles) it gets compiled as an empty class.
It would be nice to remove those empty classes from the json map.

Module Requirements

This thread will be used to discuss initial goals and requirements for the compiler. The list of features will be used to design the compiler.

Error On Compilation

I'm guessing this project is abandoned, but in case it isn't, I'm getting the following errors when running:

css-modules-compiler compile ./src -t ./lib

Error Message (One for every js file)

(node:95993) Warning: a promise was rejected with a non-error: [object Undefined]

The CSS file is successfully generated, but the JS files are just copied to the output directory - no styles object is added.

Version 1.0.0
Node v6.9.5

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.