javascript - How to load different Scss files with Meteor routed pages -
i'm creating meteor site routed iron router. every subpage has it's own folder , it's own scss
files. problem scss
files become available on every subpage after compiling.
it's easy solve adding html class="homepage"
or html class="adminpage"
, prefix styling .adminpage {...code goes here...}
, when comes excluding big files, such entire html5reset.scss
, prefixing names not solution. how exclude html5reset.scss
files particular routes?
file structure /homepage > global.scss > homepage.scss > html5reset.scss /404 > global.scss > 404page.scss > html5reset.scss /admin > global.scss > adminpage.scss // no html5 reset /framework > global.scss > frameworkpage.scss // no html5 reset
and how dynamically set html classnames:
html
<template name="homepage"> {{html_class 'homepage'}} </template>
client js
// dynamically set html class handlebars.registerhelper( "html_class", function ( htmlclass ){ var root = document.getelementsbytagname('html')[0]; if (htmlclass) { root.setattribute( "class", htmlclass ); } else { alert("this page has not html class"); root.setattribute( "class", "otherpage" ); } });
there nicer way of putting classes on html tag using iron-router:
excluding css in client folder isn't possible, there dirty way of achieving putting in public folder:
Comments
Post a Comment