Skip to content
This repository has been archived by the owner on Sep 18, 2018. It is now read-only.

seznam/IMA.js-plugin-style-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ima-plugin-style-loader

Package was moved to plugins monorepo.

This is the plugin for loading 3rd party styles for the IMA.js application. You can find the IMA.js skeleton application at https://github.com/seznam/IMA.js-skeleton or follow link 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/event/Dispatcher';
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);
		}
	});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published