link-to-import

0.1.2 • Public • Published

link-to-import Build Status

Change link of have relationship with external stylesheet into @import CSS at-rule

Install

$ npm install --save link-to-import

Usage

// > '<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Inconsolata:400,700">'

var linkToImport = require('link-to-import');
var tack = linkToImport(html, function(href, attr) {
  // return updated url value if you want to
  return href + '/changeurl';
});

console.log(tack.html, tack.link);
// > '<style>@import url("//fonts.googleapis.com/css?family=Inconsolata:400,700")</style>

API

linkToImport(html, evaluate)

html

HTML string that includes links

evaluate

To evaluate a link which could be updated or not

Return

Return updated html with link information

{
  html: String
  link: []
}

License

MIT © Jimmy Moon

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    2
  • 0.1.1
    1
  • 0.1.0
    2

Package Sidebar

Install

npm i link-to-import

Weekly Downloads

4

Version

0.1.2

License

MIT

Last publish

Collaborators

  • ragingwind