Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Automatic settings file generation #338

Merged
merged 7 commits into from
Dec 19, 2014
Merged

Automatic settings file generation #338

merged 7 commits into from
Dec 19, 2014

Conversation

gakimball
Copy link
Contributor

Maintaining the settings file is a hassle, because when a variable changes, you have to change it in the component's file, the settings file, and the documentation page all at once. This Gulp task (gulp gen) parses out the settings variables for each component and collects them in one file. If we can make this work, it could be used in the other Foundation frameworks as well.

The function takes all the code between two delimiters:

/// @Foundation.settings
// Grid
$container-width: rem-calc(900);
/* Moar Sass variables... */
///

And then collects all of the code it finds into one file. The title of each code chunk (in the above example, the title is "Grid") is used to generate the title of that section in the settings file, and could also be used to generate a table of contents at the beginning of the file.

Issues:

  • Right now it just pipes to a settings file, and comments out each variable like you do. To make it fully-featured, it should output each component's variables as a separate HTML file into a partials folder as well, and then we can use Angular's ng-include to pull in the file and display it on the right docs page.
    • Got the files output, now just need to wire them up in the docs.
  • The sets of variables are added to the settings file in the order the files come in your filesystem. So, they go in alphabetical order. Which mostly works, but we like to float a few key components to the top, like the grid and typography. The plugin should have a way to change the order the components are printed out. Fixed by manually ordering the files inserted into gulp.src()
  • The function should generate a table of contents at the top of the file.
  • If the parser goes through a file and doesn't find anything, when the file is concatenated into the settings file, it comes in as a newline. So if you happen to have a bunch of files with no settings variables, you get a bunch of random empty space between each section of the settings file. I don't know if this will be an issue or not once every file has proper annotation. Fixed by using gulp-ignore to remove files that are empty (they're empty because the parser couldn't find any settings variables)

@gakimball gakimball self-assigned this Dec 18, 2014
gakimball added a commit that referenced this pull request Dec 19, 2014
Automatic settings file generation
@gakimball gakimball merged commit 46555dd into master Dec 19, 2014
@gakimball gakimball deleted the settings-generator branch December 19, 2014 17:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

None yet

1 participant