Giter Site home page Giter Site logo

postcss-walk's Introduction

postcss-walk

Postcss runner that crawls a whole directory tree, finds all page.css (or any main-file name you want), and compiles each main file into the corresponding path in the output directory, matching the input's directory tree and filepath. It can either build everything and exit, or it can watch for file changes indefinitely. If you are using postcss-import, it will listen to changes on dependent css files and re-compile their parent files.

Compiling multiple css files from a source directory to a matching output directory can be useful for multi-page apps. Of course, you can also just use it to watch/compile a single file.

postcssWatch({
  input      // String path of input directory holding all css files
, output     // String path of output directory in which to put all compiled css
, indexName  // String name of the main index file(s) that you wish to (defaults to 'index.css')
, plugins    // Array of postcss plugins to use
, log        // Boolean, whether to log to stdout the file paths that are compiled (and compile warnings)
, watch      // Boolean, whether to watch files for changes (defaults to false)
})
const postcssWatch = require('postcss-watch')

// Source files from:
const input  = 'lib/css'
// Output compiled files to:
const output = 'public/css'

const plugins = [ require('postcss-import') ]

postcssWatch({ input, output, plugins, log: true, watch: true })

Then run node your-css-compile-script.js

postcss-walk's People

Contributors

jayrbolton avatar

Watchers

Eric Schultz avatar James Cloos avatar Roderick Campbell avatar  avatar  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.