Skip to content

Commit

Permalink
fixup! Concatenate and copy frontend resources
Browse files Browse the repository at this point in the history
Use string substitution for web root config values
  • Loading branch information
jacobrask committed Mar 20, 2015
1 parent 53645e9 commit 1815c3d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/Makefile
Expand Up @@ -52,7 +52,7 @@ static:

static/index.html: src/index.html
$(info building $(@) ...)
@cp $^ $@
@sed s/%\(WEB_ROOT\)//g $^ > $@


static/tools.js: $(TOOLS_JS)
Expand Down
30 changes: 16 additions & 14 deletions web/src/index.html
Expand Up @@ -21,7 +21,7 @@
src:
local("Source Sans Pro Light"),
local("SourceSansPro-Light"),
url(/fonts/SourceSansPro-Light.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceSansPro-Light.woff") format("woff");

}
@font-face {
Expand All @@ -31,7 +31,7 @@
src:
local("Source Sans Pro Light Italic"),
local("SourceSansPro-LightIt"),
url(/fonts/SourceSansPro-LightIt.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceSansPro-LightIt.woff") format("woff");
}

@font-face {
Expand All @@ -41,7 +41,7 @@
src:
local("Source Sans Pro"),
local("SourceSansPro-Regular"),
url(/fonts/SourceSansPro-Regular.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceSansPro-Regular.woff") format("woff");
}
@font-face {
font-family: "Source Sans Pro";
Expand All @@ -50,7 +50,7 @@
src:
local("Source Sans Pro Italic"),
local("SourceSansPro-It"),
url(/fonts/SourceSansPro-It.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceSansPro-It.woff") format("woff");
}

@font-face {
Expand All @@ -60,7 +60,7 @@
src:
local("Source Sans Pro Semibold"),
local("SourceSansPro-Semibold"),
url(/fonts/SourceSansPro-Semibold.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceSansPro-Semibold.woff") format("woff");
}
@font-face {
font-family: "Source Sans Pro";
Expand All @@ -69,7 +69,7 @@
src:
local("Source Sans Pro Semibold Italic"),
local("SourceSansPro-SemiboldIt"),
url(/fonts/SourceSansPro-SemiboldIt.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceSansPro-SemiboldIt.woff") format("woff");
}


Expand All @@ -86,7 +86,7 @@
src:
local("Source Code Pro"),
local("SourceCodePro-Regular"),
url(/fonts/SourceCodePro-Regular.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceCodePro-Regular.woff") format("woff");
}
@font-face {
font-family: "Source Code Pro";
Expand All @@ -95,7 +95,7 @@
src:
local("Source Code Pro Semibold"),
local("SourceCodePro-Semibold"),
url(/fonts/SourceCodePro-Semibold.woff) format("woff");
url("%(WEB_ROOT)fonts/SourceCodePro-Semibold.woff") format("woff");
}


Expand Down Expand Up @@ -216,7 +216,7 @@
}
</style>

<link rel="stylesheet" href="/critic.css">
<link rel="stylesheet" href="%(WEB_ROOT)critic.css">

</head>
<body>
Expand All @@ -232,19 +232,21 @@
-->
<div class="App">
<header class="TopBar">
<a href="/" class="TopBar-Logo">Critic</a>
<a href="%(WEB_ROOT)" class="TopBar-Logo">Critic</a>
<nav class="TopBar-SiteNav">
<a href="/">Dashboard</a>
<a href="%(WEB_ROOT)">Dashboard</a>
</nav>
</header>
<div class="GlobalNotifications"></div>
</div>
</div>

<script>
Config = (window.Config || {});
Critic = (window.Critic || {});

Config = (window.Config || {});
Config.WEB_ROOT = "%(WEB_ROOT)";

/**
* Catches uncaught application errors.
*/
Expand All @@ -262,10 +264,10 @@
</script>

<!-- Includes dependency handling tools and polyfills (browser globals) -->
<script src="/tools.js"></script>
<script src="%(WEB_ROOT)tools.js"></script>

<!-- Application including dependencies and views -->
<script src="/critic.js"></script>
<script src="%(WEB_ROOT)critic.js"></script>

<!-- Initialize and render the application -->
<script>
Expand Down
4 changes: 2 additions & 2 deletions web/src/routes.js
Expand Up @@ -25,12 +25,12 @@ var routes = (
Route({
name: "app",
handler: App,
path: "/"
path: Config.WEB_ROOT
},

// We could make this redirect configurable by the administrator.
Redirect({
from: "/",
from: Config.WEB_ROOT,
to: "dashboard"
}),

Expand Down

0 comments on commit 1815c3d

Please sign in to comment.