1.0.5 • Published 9 years ago

css-claw v1.0.5

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

css-claw

A tool to get all CSS and JavaScript file's url on the html page.

Installation

$ npm install css-claw

Usage

var cssClaw = require('css-claw');

cssClaw.getPaths('./index.html', {ecoding: 'utf8'}, function(data){
  console.log(data);
});

API

cssClaw.getPaths(htmlPath, options, callback)

htmlPath String

options Object

  • cssReg Object regular expression to match all relative url of CSS in the html
  • jsReg Object regular expression to match all relative url of JavaScript in the html
  • encoding String default = 'utf8'

callback: Function

var options = {
  cssReg: /<link[^>]*href=["'](.*\.css)["'][^>]*>/g,
  jsReg: /<script[^>]*src=["'](.*\.js)["'][^>]*>/g,
  encoding: 'utf8'
};

var callback = function(data){
  console.log(data);
  // do something ...
};

cssClaw.getPaths('./index.html', options, callback);
1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago