Skip to content

Commit

Permalink
setting up compose for tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
doowb committed Jan 15, 2014
1 parent 9a7d02c commit 9f30fe2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ module.exports = function(grunt) {
releases: {
options: {
compose: {
cwd: './'
cwd: '<%= config.root %>/releases'
}
},
files: [{
Expand Down
1 change: 1 addition & 0 deletions in/root/releases/A/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
volume: 1

layout: release.html
tracks: A/tracks/**/*.html
---
1 change: 1 addition & 0 deletions in/root/releases/B/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
volume: 2

layout: release.html
tracks: B/tracks/**/*.html
---
2 changes: 1 addition & 1 deletion in/templates/layouts/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h4 class="text">tracks</h4>
<ol>
<!-- can pull tracks from current directory of file being processed? -->
{{#compose src="tracks/**/*.html"}}
{{#compose src=tracks}}
<li class="track" id="track-{{slugify @title}}" title="{{@title}}">
<a href="{{slugify @title}}">{{@title}}</a>
</li>
Expand Down

2 comments on commit 9f30fe2

@waynedpj
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much for the quick help. it works as expected with both releases.

i played with this in my project and was able to get it a little more generic by placing a release.yaml file in the releases folder above A and B and in that file i placed:

# setup default properties for releases
tracksPath: <%= title %>/tracks/**/*.html

which sets the tracksPath property to the current release's title + the standard tracks glob which works. one odd thing: i tried to use dirname instead of title but dirname was always undefined?

so in my layout for releases i now have {{compose src=release.tracksPath}} and for each release it pulls in the correct subdirectory. basically this release.yaml acts like a default value for tracksPath that all releases can use. come to think of it, i guess i could also put tracksPath in the collection config? that does not seem to work either.

anyway, i have a few follow ups that i will post in the original thread once i get my head around this a bit more. thanks again to you and @jonschlinkert for the help. your solution in particular inspired some "a ha!" moments in me once i figured out how it worked.

peace

@jonschlinkert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, of course. I didn't see this earlier but I made a comment about doing this somewhere a little while (long after @doowb pushed this up). looks like we're at least headed in the right direction

Please sign in to comment.