Code Monkey home page Code Monkey logo

css-copy-assets-stream's Introduction

css-copy-assets-stream

A parcelify transform that copies the assets defined in a css file.

It parses .css and .scss, looking for local url references url('...'). When found, it copies the source files to a specified output directory of your choosing. (Ideally output should be where your bundle.css goes, then the references remain intact.)

NOTE: This project was developed for my personal use-case, and is not fully fledged at this point. Pull requests are more than welcome though.

example

var cssStream = require('..')
var fs = require('fs')
var path = require('path')

var inputFile = path.join(__dirname, 'sample.css')

fs.createReadStream(inputFile)
  .pipe(cssStream(inputFile, {output: 'output'}))
  .pipe(process.stdout)

Why does output have such a weird default value?

build/style/css is where bundle.css goes in my personal project. The reason it is written in stone like that is because you cannot specify transform options in package.json, which is where I prefer to specify my transform. this bug explains it. I am trying to get it reopened.

TODO

  • Better default value for output
  • Remove dependency on shelljs

css-copy-assets-stream's People

Contributors

tjaartvdwalt avatar

Stargazers

 avatar

Watchers

 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.