Created
February 24, 2015 03:56
-
-
Save oliverbenns/0a3da1e5218c8bf11cc9 to your computer and use it in GitHub Desktop.
Communities to jade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createViews(communities) { | |
| communities.forEach(function(community) { | |
| if (community.college !== '') { | |
| var communityView = ''; | |
| communityView += 'h1 ' + community.college + '\n' ; | |
| communityView += 'ul\n'; | |
| _.forEach(community, function(value, key) { | |
| if (value !== '' && key !== 'college') { | |
| communityView += '\tli \n\t\ta(href="' + value + '", target="_blank") ' + key + '\n'; | |
| } | |
| }); | |
| var communitySlug = slug(community.college).toLowerCase(); | |
| fs.writeFile('./views/' + communitySlug + '.jade', communityView, function(err) { | |
| if (err) { | |
| console.log(err + 'saving ' + communitySlug); | |
| } else { | |
| console.log(communitySlug + ' was saved!'); | |
| } | |
| }); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment