-
Notifications
You must be signed in to change notification settings - Fork 94
Page level apps
Currently, there is no not-shitty way to run different apps for different pages. The user must simply define the apps that will load application wide.
This document will propose one or more solutions:
The existing difficulty with defining apps at the page level is the nature of LESS variables. They can only be set once and cannot be concatenated.
However, the @appList is immediately converted to a JavaScript array anyway. Why not let the user define application-level apps in kickstrap.less
while defining apps that should run in addition on the page?
This can be done as such:
<script type="text/kickstrap">
@appList: "chosen, pinesnotify, knockoutjs";
</script>
I've already got this up and working and may go with this instead:
Anywhere on the page, you can declare "pageApps." This will be automatically added to the apps you already have defined in kickstrap.less
<script>var pageApps = ["pinesnotify", "knockoutjs"]</script>
I believe this offers the greatest flexibility since it's not a made-up language and it is the most configurable. If a developer just wanted to avoid having to go into kickstrap.less altogether, she could just put pageApps
in her global header of her HTML (or a js file) and do a javaScript .concat()
for other apps she wants to run page-by-page.
<!-- This is in the header of every page of the site--!>
<script>var pageApps = ["pinesnotify", "knockoutjs"]</script>
<!-- .... -->
<!-- This is only on this page. -->
<script> pageApps = pageApps.concat(["qunit"])</script>