GithubHelp home page GithubHelp logo

pbeshai / node-less-chokidar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sampi/node-less-chokidar

1.0 3.0 1.0 19 KB

Watch and build CSS from LESS, compatible with Create React App

License: MIT License

JavaScript 100.00%

node-less-chokidar's Introduction

node-less-chokidar

HOWTO

I made this with Create React App in mind, put something similar in your package.json

"scripts": {
    "start": "npm run build-css && run-p -ncr watch-css start-js",
    "start-js": "react-scripts start",
    
    "build": "run-s -n build-css build-js",
    "build-js": "react-scripts build",
    
    "test": "run-s -n build-css test-js",
    "test-js": "react-scripts test --env=jsdom",
    
    "build-css": "node-less-chokidar src",
    "watch-css": "node-less-chokidar src --watch"
},
"devDependencies": {
    "node-less-chokidar": "^0.1.0",
    "npm-run-all": "^4.0.2"
}

yarn start should build all CSS from the LESS files and then keep watching, yarn test will build all files and then run the tests, yarn build-css will build all the CSS, yarn watch-css will watch for changes in the LESS files and build them when they change.

Known bug

There's a bug though in the following case:

Let's say you have these files:

  • variables.less (variable definitions, no imports)
  • mixins.less (mixins, importing variables.less)
  • main.less (imports variables.less, mixins.less and uses the variables and mixins)

If you change variables.less or mixins.less it won't rebuild main.css, because it doesn't know about the dependency graph of the files. The fix is that if you know you're editing one of these files that are imported by other files, just run yarn build-css and everything will be fine.

node-less-chokidar's People

Contributors

pbeshai avatar

Stargazers

Tim Field avatar

Watchers

 avatar Tim Field avatar  avatar

Forkers

artur99

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.