Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[cleanup] bootstrap: factorization

  • Loading branch information...
commit 1c11bdbfec63a26225ebadea00b224211f12af99 1 parent 0942516
@Aqua-Ye Aqua-Ye authored BourgerieQuentin committed
View
23 stdlib/themes/bootstrap/core/core.opa
@@ -582,25 +582,26 @@ icon32 = css
_ = Client_code.register_css_declaration([icon16,icon32])
-@private
-compute_version_url(v:string) =
- if String.le(v, "1.2.0") then
- "https://raw.github.com/twitter/bootstrap/v{v}/bootstrap-{v}.min.css"
- else if String.le(v, "1.4.0") then
- "http://twitter.github.com/bootstrap/{v}/bootstrap.min.css"
- else
- "http://twitter.github.com/bootstrap/assets/css/bootstrap.css"
+Bootstrap = {{
-@private
-version = ServerReference.create("1.4.0") : reference(string)
+ version = ServerReference.create("1.4.0") : reference(string)
+
+ compute_version_url(v:string) =
+ if String.le(v, "1.2.0") then
+ "https://raw.github.com/twitter/bootstrap/v{v}/bootstrap-{v}.min.css"
+ else if String.le(v, "1.4.0") then
+ "http://twitter.github.com/bootstrap/{v}/bootstrap.min.css"
+ else
+ "http://twitter.github.com/bootstrap/assets/css/bootstrap.css"
-Bootstrap = {{
unimport() =
Resource.unregister_external_css(compute_version_url(Reference.get(version)))
+
import(v:string) =
// unregister the previous registered version
do unimport()
// set and register the new version to import
do Reference.set(version, v)
Resource.register_external_css(compute_version_url(v))
+
}}
View
4 stdlib/themes/bootstrap/style.opa
@@ -44,7 +44,7 @@
import stdlib.themes.bootstrap.core
-current_bootstrap_version = "1.4.0"
-current_bootstrap_url = "http://twitter.github.com/bootstrap/{current_bootstrap_version}/bootstrap.min.css"
+current_bootstrap_url =
+ Bootstrap.compute_version_url(Reference.get(Bootstrap.version))
do Resource.register_external_css(current_bootstrap_url)
Please sign in to comment.
Something went wrong with that request. Please try again.