modular-css

CSS Modules, but better and usable via Rollup, Vite, Webpack, CLI, PostCSS, or JS API

MIT License

Downloads
29.7K
Stars
288
Committers
24

Bot releases are hidden (Show)

modular-css - Documentation and globbing!

Published by tivac about 8 years ago

This is a pretty minor release, mostly focused on cleaning up the documentation and removing a confusing signature for the .glob() method.

Breaking Changes

  • .glob() no longer accepts a dir arg, use cwd instead.
  • modular-css no longer ships with a Promise polyfill.
modular-css - Rollup errors

Published by tivac about 8 years ago

Small release dedicated to ensuring that any errors from postcss plugins (particularly in the after slot) are properly exposed.

#178 Better handle errors within rollup

modular-css - CLI improvements

Published by tivac about 8 years ago

The CLI has long been an after-thought, but after running into a few places where an actual CLI or even CLI-style functionality would be useful it's time for a revamp.

The CLI has been completely rewritten, now w/ actual support for --help and other useful things you'd expect from a CLI.

usage: modular-css [options] <glob>...

options:
    -d, --dir DIR       Directory to search from [process cwd]
    -o, --out FILE      File to write output CSS to [stdout]
    -j, --json FILE     File to write output compositions JSON to
    -m, --map           Include inline source map in output
    --help              Show this help

So as an example, here's how you'd shove together all the .css files in a directory while ignoring everything in node_modules folders, and then outputting the CSS and JSON to files.

> modular-css -o ./out.css -j ./out.json **/*.css !**/node_modules/**

or use the CLI-style functionality from JS

var glob = require("modular-css/glob");

glob({
    dir    : "/some/dir",
    search : [ "**/*.css", "!**/node_modules/**" ]
});

This release also includes an update to [email protected] which required some flopping around but should improve a few things.

modular-css - Strict mode

Published by tivac over 8 years ago

In fixing #82 it became apparent that more precise control for warnings vs errors was necessary, so now modular-css defaults to strict mode. Warnings from PostCSS plugins will be treated as errors and appropriately blow everything up!

To disable this behavior pass strict: false in your options.

modular-css - Source maps + @values = <3

Published by tivac over 8 years ago

Since sourcemaps got some love for v0.20.0 it was finally time to take a look at exposing @value chains in source maps. It ended up not being that hard, so here we go! Now sourcemaps will show you where a value replacement came from, which is really nice!

See #129 for comparison links to the old source maps vs the new, more thorough ones.

modular-css - Sourcemap fixups!

Published by tivac over 8 years ago

Sourcemaps were kinda broken in a bunch of dumb ways. They were broken deep in the core when building the combined CSS file, and the rollup plugin wasn't doing sensible things. Now sourcemaps are reasonable and accurate from the core on out, and the rollup plugin does all the right things so it works as it should.

🎉 🎉 🎉

modular-css - Browserify symlinks were broken, now they're not

Published by tivac over 8 years ago

Symlinks were broken when using the browserify plugin due to a strange interaction between the browserify transform and the dependencies pipeline. Fixed it by ensuring that modular-css always use the actual path on disk when building up the dependency graph.

Thanks to @julien-f for reporting #105!

modular-css - Customizable CWD

Published by tivac over 8 years ago

v0.13.0 really only adds one feature, a customizable cwd! No longer are you shackled to process.cwd() (although it still defaults to that).

This helped us solve an issue around junctions and relative paths being bunk, who knows what it might solve for you!

modular-css - Source maps!

Published by tivac over 8 years ago

v0.11.2 (and v0.11.1, actually) are all about improving the actual day-to-day experience of using modular-css. Now when you are instantiating browserify and you set the debug option you'll automatically get inline sourcemaps in your CSS.

This has also been fixed up so that if you're using the API you can easily enable source maps by passing map : true as an option!

modular-css - More Promises!

Published by tivac over 8 years ago

In order for after plugins to be able to fully process the output it was necessary to have .css() (now renamed .output()) return a PostCSS Result or LazyResult instance.

But now stuff like cssnano will work really easily, which is excellent!

modular-css - Consistent tooling outputs!

Published by tivac over 8 years ago

So it took some real doing, but browserify/watchify/factor-bundle all should now be fully aware of the CSS dependency graph which means everything should work exactly like you'd expect. That's... not a great selling point, but an improvement over how things were!

Also the CLI now works after the changes in 0.9.x which totally broke things, I apologize!

modular-css - Promises everywhere!

Published by tivac almost 9 years ago

Wanted to support async postcss plugins like cssnano, which meant I had to rework large parts of the core to use promises for flow control. And now it's done, hooray!

API changes are visible here: https://github.com/tivac/modular-css/blob/v0.9.0/README.md#api

modular-css - Nicer browserify/watchify behavior

Published by tivac almost 9 years ago

Small release, mostly to fix #32 with #33.

Now when browserify/watchify barfs it'll look better and be way more useful!