Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/popomore/css-imports
find all @import in css
https://github.com/popomore/css-imports
Last synced: about 2 months ago
JSON representation
find all @import in css
- Host: GitHub
- URL: https://github.com/popomore/css-imports
- Owner: popomore
- Created: 2014-03-31T16:41:11.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-08-28T09:08:47.000Z (over 10 years ago)
- Last Synced: 2024-11-16T16:16:26.541Z (about 2 months ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
Awesome Lists containing this project
README
# css-imports [![Build Status](https://travis-ci.org/popomore/css-imports.png?branch=master)](https://travis-ci.org/popomore/css-imports) [![Coverage Status](https://coveralls.io/repos/popomore/css-imports/badge.png?branch=master)](https://coveralls.io/r/popomore/css-imports?branch=master)
find all @import in css
---
## Install
```
$ npm install css-imports -g
```## Usage
Css file a.css
```
@import url("./b.css");
@import url("c.css");
```Run code
```
var imports = require('css-imports');
imports(fs.readFileSync('a.css'));
```return
```
[
{
string: '@import url("./b.css");',
path: './b.css',
index: 0
},
{
string: '@import url("c.css");',
path: 'c.css',
index: 24
}
]
```You can add a callback to replace css file
```
imports(fs.readFileSync('a.css'), function(item) {
return '@import url("' + resolve(item.path) + '");';
});
```## LISENCE
Copyright (c) 2014 popomore. Licensed under the MIT license.