Socket
Socket
Sign inDemoInstall

oust

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oust

Extract a list of stylesheets, scripts or HTML imports from HTML


Version published
Weekly downloads
23K
decreased by-5.85%
Maintainers
1
Weekly downloads
 
Created
Source

oust Build Status

Extract a list of stylesheets, scripts or HTML imports from HTML

Install

npm install oust --save-dev

Usage

First include:

var oust = require('oust');

Resource links can then be extracted from either files:

oust({ src: 'test/sample/index.html' } , function ( hrefs ){
	console.log( hrefs );
});
Extract script references <script src>
oust({ 
	src: 'test/sample/index.html', 
	selector: 'script', 
	attribute: 'src'
	}, function ( srcs ){
		console.log( srcs );
	});
oust({ 
	src: 'test/imports.html', 
	selector: 'link[rel="import"]', 
	attribute: 'href' 
	}, function ( hrefs ){
		console.log( hrefs );
	});
Or from HTML string input:
oust({ 
	source: '<html><link rel="stylesheet" href="styles/main.css"></html>' 
	}, function ( hrefs ){
		console.log( hrefs );
	});

API

Options
AttributeDefaultDescription
src``a valid path to the file you wish to parse
source``a valid string to parse for references
selectorlink[rel="stylesheet"]a selector to query for
attributehrefan attribute to read from the selector query

The second parameter to oust() is a callback function which will include the array of resources discovered.

License

Released under an Apache 2 license. © Google 2014.

Keywords

FAQs

Package last updated on 13 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc