diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-01-31 00:07:23 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-01-31 00:07:23 +0100 |
commit | d7059e321f796301c19cb1b9746eb3e27d7480bd (patch) | |
tree | 43f297d4a0646af5948aa3cc06bb836779097e56 | |
parent | 20224268cfd05aefd935547e44dd938cf6e2e312 (diff) | |
download | kvision-d7059e321f796301c19cb1b9746eb3e27d7480bd.tar.gz kvision-d7059e321f796301c19cb1b9746eb3e27d7480bd.tar.bz2 kvision-d7059e321f796301c19cb1b9746eb3e27d7480bd.zip |
Option to disable Bootstrap CSS
6 files changed, 81 insertions, 3 deletions
diff --git a/examples/helloworld/src/main/kotlin/com/example/Main.kt b/examples/helloworld/src/main/kotlin/com/example/Main.kt index fba5f87a..53b6b0ae 100644 --- a/examples/helloworld/src/main/kotlin/com/example/Main.kt +++ b/examples/helloworld/src/main/kotlin/com/example/Main.kt @@ -23,6 +23,7 @@ fun main(args: Array<String>) { } if (document.body != null) { + KVManager.start() application = start(state) } else { KVManager.init() diff --git a/examples/showcase/src/main/kotlin/com/example/Main.kt b/examples/showcase/src/main/kotlin/com/example/Main.kt index 98c94f25..a3891526 100644 --- a/examples/showcase/src/main/kotlin/com/example/Main.kt +++ b/examples/showcase/src/main/kotlin/com/example/Main.kt @@ -23,6 +23,7 @@ fun main(args: Array<String>) { } if (document.body != null) { + KVManager.start() application = start(state) } else { KVManager.init() diff --git a/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt index 55c91436..7ca0ce26 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt @@ -9,15 +9,23 @@ import com.github.snabbdom.eventListenersModule import com.github.snabbdom.propsModule import com.github.snabbdom.styleModule import pl.treksoft.kvision.require +import pl.treksoft.kvision.routing.Routing import pl.treksoft.kvision.routing.routing import kotlin.browser.document import kotlin.dom.clear +external val kvBootstrap: Boolean? + object KVManager { internal const val AJAX_REQUEST_DELAY = 300 internal const val KVNULL = "#kvnull" - private val bootstrapWebpack = require("bootstrap-webpack") + @Suppress("UnsafeCastFromDynamic") + private val bootstrapWebpack = if (js("typeof KV_NO_BOOTSTRAP_CSS !== 'undefined'")) { + require("bootstrap-webpack!./js/bootstrap.config.js") + } else { + require("bootstrap-webpack") + } private val fontAwesomeWebpack = require("font-awesome-webpack") private val resizable = require("jquery-resizable-dom") private val awesomeBootstrapCheckbox = require("awesome-bootstrap-checkbox") @@ -26,7 +34,7 @@ object KVManager { private val bootstrapSelectI18n = require("./js/bootstrap-select-i18n.min.js") private val bootstrapSelectAjaxCss = require("ajax-bootstrap-select/dist/css/ajax-bootstrap-select.min.css") private val bootstrapSelectAjax = require("ajax-bootstrap-select/dist/js/ajax-bootstrap-select.min.js") -// private val bootstrapSelectAjaxI18n = + // private val bootstrapSelectAjaxI18n = // require("ajax-bootstrap-select/dist/js/locale/ajax-bootstrap-select.pl-PL.min.js") private val trixCss = require("trix/dist/trix.css") private val trix = require("trix") @@ -63,6 +71,10 @@ object KVManager { fun init() { } + fun start() { + routing = Routing() + } + fun shutdown() { routing.destroy() } diff --git a/src/main/kotlin/pl/treksoft/kvision/routing/Routing.kt b/src/main/kotlin/pl/treksoft/kvision/routing/Routing.kt index 709f966c..fab8643c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/routing/Routing.kt +++ b/src/main/kotlin/pl/treksoft/kvision/routing/Routing.kt @@ -4,4 +4,4 @@ import pl.treksoft.navigo.Navigo open class Routing : Navigo(null, true, "#!") -val routing = Routing() +var routing = Routing() diff --git a/src/main/resources/js/bootstrap.config.js b/src/main/resources/js/bootstrap.config.js new file mode 100644 index 00000000..906942d1 --- /dev/null +++ b/src/main/resources/js/bootstrap.config.js @@ -0,0 +1,64 @@ +module.exports = { + + // Default for the style loading + styleLoader: 'style-loader!css-loader!less-loader', + + scripts: { + 'transition': true, + 'alert': true, + 'button': true, + 'carousel': true, + 'collapse': true, + 'dropdown': true, + 'modal': true, + 'tooltip': true, + 'popover': true, + 'scrollspy': true, + 'tab': true, + 'affix': true + }, + styles: { + "mixins": false, + + "normalize": false, + "print": false, + + "scaffolding": false, + "type": false, + "code": false, + "grid": false, + "tables": false, + "forms": false, + "buttons": false, + + "component-animations": false, + "glyphicons": false, + "dropdowns": false, + "button-groups": false, + "input-groups": false, + "navs": false, + "navbar": false, + "breadcrumbs": false, + "pagination": false, + "pager": false, + "labels": false, + "badges": false, + "jumbotron": false, + "thumbnails": false, + "alerts": false, + "progress-bars": false, + "media": false, + "list-group": false, + "panels": false, + "wells": false, + "close": false, + + "modals": false, + "tooltip": false, + "popovers": false, + "carousel": false, + + "utilities": false, + "responsive-utilities": false + } +}; diff --git a/src/main/resources/js/bootstrap.config.less b/src/main/resources/js/bootstrap.config.less new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/main/resources/js/bootstrap.config.less |