Skip to content

Instantly share code, notes, and snippets.

@stowball
Last active December 16, 2015 06:48
Show Gist options
  • Select an option

  • Save stowball/5393732 to your computer and use it in GitHub Desktop.

Select an option

Save stowball/5393732 to your computer and use it in GitHub Desktop.
Pondering how the best way to selectivity include CSS and related JS
/*
If a user chooses to not include the partial for modal styles,
how can we automatically not include the modal function and its init?
Ideally, carousel and modal would be in their own file. It's like we need Sass for JS
*/
(function() {
carousel.init();
modal.init();
var carousel = {
init: function() {
// setup carousels
}
};
var modal = {
init: function() {
// setup modals
}
};
})();
(function() {
// include carousel.init
// include modal.init
//include carousel.js
//include modal.js
})();
@include "partials/carousel"
@include "partials/modal"
// A user can easily choose to exclude these modules if they don't want them in the CSS
var modal = {
init: function() {
// setup modals
// could be 1000 lines long
}
};
/* Here are my styles for modal dialogs */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment