Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elmarti/super-css-loader
A CSS loader for meteor
https://github.com/elmarti/super-css-loader
Last synced: 5 days ago
JSON representation
A CSS loader for meteor
- Host: GitHub
- URL: https://github.com/elmarti/super-css-loader
- Owner: elmarti
- Created: 2016-02-07T16:38:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-08T21:29:12.000Z (almost 9 years ago)
- Last Synced: 2024-11-02T20:42:12.705Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://atmospherejs.com/elmarti/super-css-loader
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# super-css-loader
super-css-loader lets you load and remove CSS the easy way
* param1: url - root is public folder, urls can be used aswell
* param2 : attributes (optional) - a set of attributes to append to the load element (you must set to null, if not used)
* param3 : options (optional) contains the id you would like to assign to the CSS ( you must set to null if not used, a random id will be assigned)
* param4 : callback (optional)
* return : an object containing the element object and the id### Load static (can be removed) CSS into a single page
If you load in onRendered(), there is sometimes a moment where the page appears without CSS - this is not the case with onCreated()
```javascriptTemplate.parent_template.onCreated(function() {
superCSSLoader.loadStatic("/front.css",
{
charset:"utf-8"
},{
id:"myCSSID"
},
function(data) {
//id to access span>link element
console.log(data.id);
//the HTML element
console.log(data.element);
}
);
});let cssData = superCSSLoader.loadStatic("/front.css",
{
charset:"utf-8"
},{
id:"myCSSID"
}
);
```###Removing the CSS
You simply need to destroy the element containing the CSS
```javascript
$("#assignedID").remove();
```
#TODO
* add non static load type