https://github.com/jquery/builder-amd-css
Generate the CSS bundle of an AMD modular project on the fly on Node.js
https://github.com/jquery/builder-amd-css
Last synced: 25 days ago
JSON representation
Generate the CSS bundle of an AMD modular project on the fly on Node.js
- Host: GitHub
- URL: https://github.com/jquery/builder-amd-css
- Owner: jquery
- License: mit
- Created: 2015-02-02T16:13:42.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2026-01-19T10:19:14.000Z (4 months ago)
- Last Synced: 2026-01-19T17:38:17.257Z (4 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
- Dco: DCO.md
Awesome Lists containing this project
README
## Why builder-amd-css?
Use `builder-amd-css` to generate the CSS bundle of an AMD modular project that
uses the `css!` plugin definitions.
It's ideal for applications that builds bundles on the fly using [Node.js][].
It's not a substitute for css plugins like [require-css][].
[Node.js]: http://nodejs.org/
[require-css]: https://github.com/guybedford/require-css
## Usage
npm install builder-amd-css
```javascript
var fs = require( "js" );
var amdCssBuilder = require( "builder-amd-css" );
var files = {
"main.js": fs.readFileSync( "./main.js" ),
"main.css": fs.readFileSync( "./main.css" ),
"foo.js": fs.readFileSync( "./foo.js" ),
"foo.css": fs.readFileSync( "./foo.css" ),
"bar.js": fs.readFileSync( "./foo.js" ),
"bar.css": fs.readFileSync( "./bar.css" ),
...
}
amdCssBuilder( files, {
include: "main"
}, function( error, builtCss ) {
...
});
```
## API
- **`amdCssBuilder( files, requirejsConfig, callback )`**
**files** *Object* containing (path, data) key-value pairs, e.g.:
```
{
: ,
: ,
...
}
```
**requirejsConfig** *Object* [require.js build configuration][].
**callback** *Function* called with three arguments: null or an Error object, a
String with the built css content, an Object with the cloned built files
structure.
[require.js build configuration]: https://github.com/jrburke/r.js/blob/master/build/example.build.js
## Test
npm test
## License
MIT © [OpenJS Foundation and other contributors](https://openjsf.org/)