css-imports
find all @import in css
Last updated 10 years ago by popomore .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install css-imports 
SYNC missed versions from official npm registry.

css-imports Build Status Coverage Status

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.

Current Tags

  • 0.3.1                                ...           latest (10 years ago)

5 Versions

  • 0.3.1                                ...           10 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.1                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |