-
Notifications
You must be signed in to change notification settings - Fork 177
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
Build system 0.0.1 #31
Build system 0.0.1 #31
Conversation
args: [] | ||
})) | ||
.pipe(gulp.dest('./dist')); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for pandoc here. just use gulp-markdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I was wondering should I go ahead with pandoc (since I am using it) or use gulp-markdown (heh, its still there in the package.json I have included). My motivation was that since I am using pandoc to generate pdf for now, I might as well use it to generate html from markdown simply to keep it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per my later comment, we should think about how we're going to handle ePub etc.
On this point:
Pandoc has a css and template flag. |
IMO, I think If you need to, you can easily generate the markdown from the JSON as needed. |
gulp-markdown-pdf supports custom CSS: https://github.com/alanshaw/markdown-pdf#optionscsspath
|
Summarizing the discussion around pandoc and non-pandoc solution (npm modules) to help come to a consensus. AFAIK, the formats we are looking to export this book are
Pandoc@sindresorhus is concerned regarding speed and ease of installation Non-Pandoc solutionI am particularly concerned regarding the support when opting to use npm modules. I am leaning a bit towards pandoc. |
@dashed Do you have any thoughts around moving to semantic file naming as suggested in #21 and based off @sindresorhus #31 (comment)? I'll soon be submitting a patch for this. |
@rowoot i would prefer both. Pandoc for epub/mobi and gulp-markdown-pdf/gulp-markdown for pdf/html. That way we can skip the tex dependency, while still being able to produce all wanted formats. |
@rowoot I think semantic file naming may be the way to go -- though I don't think it may matter when you consider something like the following for JSON: [
{
"name": "Introduction",
"file": "path/to/file"
},
{
"name": "Build Systems",
"toc": [
{
"name": "Modern tools vs shell scripts",
"file": "build-systems/modern-tools-vs-shell-scripts.md"
}
]
}
] If it's possible to have metadata in the markdown files, then you can just outsource the So, something like https://gist.github.com/Dashed/8792825 would allow custom frontmatter in YAML for markdown files. All it does is extract frontmatter. You'll need another transform stream to parse them when building the toc. |
I tried both the approaches, and here is my feedback.
After re-evaluating, I am leaning towards the TOC based approach because of its simplicity (from the perspective of a user who is contributing to the book and the folks who would review the PR). Thoughts? |
Just curious, what does your JSON object look like for the TOC based approach? |
Looks like the JSON file can get gnarly really fast. What if you store it in YAML format? Then convert to JSON when importing it. I think either JSON or YAML would still be verbose. Looking at the alternative solutions, it looks like, in my opinion, that the markdown format (as a list) looks to be the way to go -- in terms of readability and maintainability. At this point, it would be consideration between of having custom markdown parser and the verbosity that the JSON approach requires. I feel that having a table-of-contents metadata file should somehow be unnecessary -- but it wouldn't be a big deal if it's easy to maintain. |
Readability would still not match the markdown approach.
My focus is to make the process of contributing content to the book super simple. Thus I am leaning towards using markdown (over JSON) for the TOC approach even though there is some minor preprocessing (parse the markdown file) using gulp.
Along with being a metadata file, It also helps in structuring the chapters/topics when exporting to different formats (no need for semantic naming). |
My vote's on the markdown approach of TOC as is. |
Changelog:
Usage:
|
(ping) .. does this look good to merge? |
I noticed there is no task for individual HTML pages. I only see a concatenated, conglomerate version. |
I did think about it, but descoped it at the moment till I can find out better mechanisms (along with pros and cons) of exporting it as a site. For now, removing the |
Does the markdown-to-html plugin support templates? |
This looks good to merge but will need a little rebase work. Once we're all green on this side I'd be happy for us to land this. |
"gulp-util": "~2.2.12", | ||
"gulp": "~3.5.0", | ||
"gulp-markdown": "~0.1.2", | ||
"through": "~2.3.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
through is bugged, use through2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to through2. Out of curiosity why do you feel through is bugged? (gulp-concat uses through)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to use it with gulp and plugins, but it's a bit buggy (don't remember the details) and it's using old streams. Through2 is just a tiny abstraction of new streams. Look at it's code. There's barely any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet, thanks for that information! through2 looks good. I recently updated a gulp plugin (gulp-pandoc) with it.
@dashed What do you mean by templates? The gulp markdown task uses https://github.com/chjj/marked library if this helps. Changelog:
A draft PDF version of the book (currently not styled), https://dl.dropboxusercontent.com/u/32194349/book.pdf |
Thanks for all your work on this @rowoot. Landed! |
Thanks @addyosmani @sindresorhus and @dashed for all the feedback! Just FYI, this PR addresses #21 and #8 (feel free to close the issues or let me know if there is something missing). |
Addresses Issue #8
[Dependencies: Pandoc and TeXLive|MacTex]
Quick heads up: I used gulp instead of grunt to play with it. I am willing to change back to grunt if required.
This PR adds a primitive build system to generate the book in pdf and html formats. Thanks to the use pandoc, this book can be exported to various formats with the addition of simple gulp tasks. I have also listed the requirements, constraints I assumed for my proposed solution. Refer to README.md for instructions on how to use the gulp tasks to build the book. Happy to iterate based on feedback
Requirements
Constraints:
Proposed solution:
This could have been a simple JSON file as well since the main purpose is to define how the content should be exported (as pdf,html or any other file format), but I chose markdown to be consistent with the content. I also felt having a toc.md would be flexibile to generate a (well linked) toc portion of the book easily.
I used pandoc since I felt that it addressed the need to export to various file types as required.
Pros
Cons