npm

@ima/plugin-style-loader
TypeScript icon, indicating that this package has built-in type declarations

4.0.3 • Public • Published

@ima/plugin-style-loader

This is the plugin for loading 3rd party styles for the IMA.js application. You can visit our site https://imajs.io.

Installation

npm install @ima/plugin-style-loader --save
// /app/build.js

var vendors = {
	common: [
		'@ima/plugin-style-loader'
	]
};

/*
Now is script loader plugin available as:

import { StyleLoaderPlugin, events, defaultDependencies } from '@ima/plugin-style-loader';
*/

Usage

import { Dispatcher } from '@ima/core';
import { StyleLoaderPlugin, events as StyleLoaderEvents } from '@ima/plugin-style-loader';

oc
	.get(StyleLoaderPlugin)
	.load('//www.example.com/style.css')
	.then((result) => {
		console.log('Style is loaded.', result.url);
	})
	.catch((error) => {
		console.log('Style failed to load.', error);
	});

oc
	.get(Dispatcher)
	.listen(StyleLoaderEvents.LOADED, (result) => {
		if (result.error) {
			console.log('Style is not loaded.', result.url);
		} else {
			console.log('Style is loaded.', result.url);
		}
	});

Package Sidebar

Install

npm i @ima/plugin-style-loader

Weekly Downloads

1

Version

4.0.3

License

MIT

Unpacked Size

35 kB

Total Files

27

Last publish

Collaborators

  • corvidism
  • mjancarik
  • filipoliko
  • matej.marcisovsky
  • jsimck
  • hartja
  • zdenek.lastuvka
  • jan.kucera
  • ondrej.sliva