Skip to content

Commit

Permalink
Created custom collections to hopefully avoid the performance issues …
Browse files Browse the repository at this point in the history
…you were facing
  • Loading branch information
balupton committed Sep 26, 2013
1 parent 6ee4e60 commit c781706
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 30 deletions.
43 changes: 17 additions & 26 deletions node/docpad.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,7 @@
# It is simply a CoffeeScript Object which is parsed by CSON
docpadConfig = {

outPath: '../docs',
renderPasses: 1,

enabledPlugins:
handlebars: false
html2coffee: false
jade: false
marked: false
paged: false
livereload: false

# Check Version
# Whether or not to check for newer versions of DocPad
checkVersion: true # default

documentsPaths: [ # default
'documents'
]

# Files Paths
# An array of paths which contents will be treated as files
# If it is a relative path, it will have the resolved `srcPath` prepended to it
filesPaths: [ # default
'files'
'public'
]
outPath: '../docs'

# =================================
# Template Data
Expand Down Expand Up @@ -112,6 +87,22 @@ docpadConfig = {
@site.keywords.concat(@document.keywords or []).join(', ')


# =================================
# Custom Collections

collections:
uiElements: ->
@getCollection("documents").findAllLive({type: $in: ['UI Element']}, [{title: 1}])

uiCollections: ->
@getCollection("documents").findAllLive({type: $in: ['UI Collection']}, [{title: 1}])

uiViews: ->
@getCollection("documents").findAllLive({type: $in: ['UI View']}, [{title: 1}])

uiModules: ->
@getCollection("documents").findAllLive({type: $in: ['UI Module', 'UI Behavior']}, [{title: 1}])

# =================================
# DocPad Events

Expand Down
8 changes: 4 additions & 4 deletions node/src/documents/index.html.eco
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ css : 'index'
title : 'Getting Started'
type : 'Semantic'
---
<% uiElements = @getCollection("documents").findAllLive({type: $in: ['UI Element']},[{title: 1}]).toJSON() %>
<% uiCollections = @getCollection("documents").findAllLive({type: $in: ['UI Collection']},[{title: 1}]).toJSON() %>
<% uiViews = @getCollection("documents").findAllLive({type: $in: ['UI View']},[{title: 1}]).toJSON() %>
<% uiModules = @getCollection("documents").findAllLive({type: $in: ['UI Module', 'UI Behavior']},[{title: 1}]).toJSON() %>
<% uiElements = @getCollection("uiElements").toJSON() %>
<% uiCollections = @getCollection("uiCollections").toJSON() %>
<% uiViews = @getCollection("uiViews").toJSON() %>
<% uiModules = @getCollection("uiModules").toJSON() %>
<script src="/javascript/home.js"></script>

<div class="masthead segment">
Expand Down

0 comments on commit c781706

Please sign in to comment.