Skip to content

Dynamically generate component navigation #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion components/articles/title-text-image/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,34 @@ <h2 class="f5 mt5">Modules</h2>




<h4 class="mt5">Install these modules via npm</h4>
<code>npm i --save tachyons-line-height tachyons-widths tachyons-spacing tachyons-type-scale tachyons-typography</code>
</section>
</main>




articles<br>

<a href="/components/articles/title-text-image/index.html">Articles Title Text Image</a><br>

<a href="/components/articles/title-text/index.html">Articles Title Text</a><br>


forms<br>

<a href="/components/forms/sign_in/1/index.html">Forms Sign In 1</a><br>

<a href="/components/forms/sign_up/1/index.html">Forms Sign Up 1</a><br>


layout<br>

<a href="/components/layout/flag-object/index.html">Layout Flag Object</a><br>



<footer class="bg-near-white mid-gray ph3 ph5-ns pv5 pv6-ns bt b--black-10">
<a href="https://twitter.com/intent/tweet?text=Tachyons: Functional CSS for Humans.&url=http://tachyons.io" target="_blank" class="dn mb3 twitter bg-white link dim br2 ph2 pb1 pt0 lh-solid" style="background-color: #55acee;">
<svg class="geomicon dib v-mid" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="#fff">
Expand Down
22 changes: 21 additions & 1 deletion components/articles/title-text/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,34 @@ <h2 class="f5 mt5">Modules</h2>




<h4 class="mt5">Install these modules via npm</h4>
<code>npm i --save tachyons-line-height tachyons-spacing tachyons-typography</code>
</section>
</main>




articles<br>

<a href="/components/articles/title-text-image/index.html">Articles Title Text Image</a><br>

<a href="/components/articles/title-text/index.html">Articles Title Text</a><br>


forms<br>

<a href="/components/forms/sign_in/1/index.html">Forms Sign In 1</a><br>

<a href="/components/forms/sign_up/1/index.html">Forms Sign Up 1</a><br>


layout<br>

<a href="/components/layout/flag-object/index.html">Layout Flag Object</a><br>



<footer class="bg-near-white mid-gray ph3 ph5-ns pv5 pv6-ns bt b--black-10">
<a href="https://twitter.com/intent/tweet?text=Tachyons: Functional CSS for Humans.&url=http://tachyons.io" target="_blank" class="dn mb3 twitter bg-white link dim br2 ph2 pb1 pt0 lh-solid" style="background-color: #55acee;">
<svg class="geomicon dib v-mid" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="#fff">
Expand Down
22 changes: 21 additions & 1 deletion components/forms/sign_in/1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,34 @@ <h2 class="f5 mt5">Modules</h2>




<h4 class="mt5">Install these modules via npm</h4>
<code>npm i --save tachyons-borders tachyons-border-colors tachyons-display tachyons-font-weight tachyons-forms tachyons-letter-spacing tachyons-links tachyons-widths tachyons-skins tachyons-spacing tachyons-text-transform tachyons-type-scale tachyons-utilities tachyons-vertical-align tachyons-hovers tachyons-max-widths</code>
</section>
</main>




articles<br>

<a href="/components/articles/title-text-image/index.html">Articles Title Text Image</a><br>

<a href="/components/articles/title-text/index.html">Articles Title Text</a><br>


forms<br>

<a href="/components/forms/sign_in/1/index.html">Forms Sign In 1</a><br>

<a href="/components/forms/sign_up/1/index.html">Forms Sign Up 1</a><br>


layout<br>

<a href="/components/layout/flag-object/index.html">Layout Flag Object</a><br>



<footer class="bg-near-white mid-gray ph3 ph5-ns pv5 pv6-ns bt b--black-10">
<a href="https://twitter.com/intent/tweet?text=Tachyons: Functional CSS for Humans.&url=http://tachyons.io" target="_blank" class="dn mb3 twitter bg-white link dim br2 ph2 pb1 pt0 lh-solid" style="background-color: #55acee;">
<svg class="geomicon dib v-mid" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="#fff">
Expand Down
22 changes: 21 additions & 1 deletion components/forms/sign_up/1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,34 @@ <h2 class="f5 mt5">Modules</h2>




<h4 class="mt5">Install these modules via npm</h4>
<code>npm i --save tachyons-borders tachyons-border-colors tachyons-display tachyons-letter-spacing tachyons-line-height tachyons-links tachyons-max-widths tachyons-widths tachyons-skins tachyons-text-transform tachyons-type-scale tachyons-typography tachyons-utilities tachyons-hovers</code>
</section>
</main>




articles<br>

<a href="/components/articles/title-text-image/index.html">Articles Title Text Image</a><br>

<a href="/components/articles/title-text/index.html">Articles Title Text</a><br>


forms<br>

<a href="/components/forms/sign_in/1/index.html">Forms Sign In 1</a><br>

<a href="/components/forms/sign_up/1/index.html">Forms Sign Up 1</a><br>


layout<br>

<a href="/components/layout/flag-object/index.html">Layout Flag Object</a><br>



<footer class="bg-near-white mid-gray ph3 ph5-ns pv5 pv6-ns bt b--black-10">
<a href="https://twitter.com/intent/tweet?text=Tachyons: Functional CSS for Humans.&url=http://tachyons.io" target="_blank" class="dn mb3 twitter bg-white link dim br2 ph2 pb1 pt0 lh-solid" style="background-color: #55acee;">
<svg class="geomicon dib v-mid" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="#fff">
Expand Down
22 changes: 21 additions & 1 deletion components/layout/flag-object/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,34 @@ <h2 class="f5 mt5">Modules</h2>




<h4 class="mt5">Install these modules via npm</h4>
<code>npm i --save tachyons-display tachyons-line-height tachyons-max-widths tachyons-spacing tachyons-utilities tachyons-vertical-align</code>
</section>
</main>




articles<br>

<a href="/components/articles/title-text-image/index.html">Articles Title Text Image</a><br>

<a href="/components/articles/title-text/index.html">Articles Title Text</a><br>


forms<br>

<a href="/components/forms/sign_in/1/index.html">Forms Sign In 1</a><br>

<a href="/components/forms/sign_up/1/index.html">Forms Sign Up 1</a><br>


layout<br>

<a href="/components/layout/flag-object/index.html">Layout Flag Object</a><br>



<footer class="bg-near-white mid-gray ph3 ph5-ns pv5 pv6-ns bt b--black-10">
<a href="https://twitter.com/intent/tweet?text=Tachyons: Functional CSS for Humans.&url=http://tachyons.io" target="_blank" class="dn mb3 twitter bg-white link dim br2 ph2 pb1 pt0 lh-solid" style="background-color: #55acee;">
<svg class="geomicon dib v-mid" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="#fff">
Expand Down
13 changes: 13 additions & 0 deletions src/components-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ module.exports = function () {

var template = fs.readFileSync('src/templates/components.html', 'utf8')

var componentsForNav = {}
components.map(function (component) {
var componentTokens = component.replace('src/components/', '').split('/')
var category = componentTokens[0]

componentsForNav[category] = componentsForNav[category] || []
componentsForNav[category].push({
href: component.replace('src', '').replace('.html', '') + '/index.html',
name: getTitle(component)
})
})

components.forEach(function (component) {
var newDir = rmHtmlExt(component.replace('src/', ''))
var newFile = newDir + '/index.html'
Expand All @@ -47,6 +59,7 @@ module.exports = function () {
frontMatter.footer = fs.readFileSync('src/templates/footer.html', 'utf8')
frontMatter.analytics = fs.readFileSync('src/templates/ga.html', 'utf8')
frontMatter.head = fs.readFileSync('src/templates/head.html', 'utf8')
frontMatter.componentsForNav = componentsForNav

var moduleSrcs = {}
var getModules = postcss.plugin('get-modules', function () {
Expand Down
8 changes: 7 additions & 1 deletion src/templates/components.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ <h2 class="f5 mt5">Modules</h2>
<li class="fl w-100 w-50-m w-33-ns"><a class="f6 link dim blue fw6" href="https://github.com/tachyons-css/<%= module %>"><%= module %></a></li>
<% } %>


<h4 class="mt5">Install these modules via npm</h4>
<code>npm i --save <%= modules.join(' ') %></code>
</section>
Expand All @@ -54,6 +53,13 @@ <h4 class="mt5">Install these modules via npm</h4>
<li><%= klass %></li>
<% } %>

<% Object.keys(componentsForNav).map(function(category) { %>
<%= category %><br>
<% componentsForNav[category].map(function(componentForNav) { %>
<a href="<%= componentForNav.href %>"><%= componentForNav.name %></a><br>
<% }) %>
<% }) %>

<%= footer %>
<%= analytics %>
</body>
Expand Down