Open drewatk opened 6 years ago
1 - The reason we didn't go with custom file extensions is because text editors won't have syntax highlighting. If that's not too big of an issue, we can switch.
2 -
"I don't think the compiler should not handle multiple source files, the CLI or the API will call each call a render(<cleave html>, <some sort of output or file printer>)
function"
What do you mean here?
.clv.html
would still be recognized as html? That could also be the extension for partials. Edit: Tested on VSCode and it works.so if even the partials are clv.html
how would we know what files need to be put into the output directory? We could restrict them to a certain folder structure and say that all source files need to be in pages
directory, but I thought giving a config gives more flexibility to a user.
Although a CLI wasn't in my mind then.
So how exactly would the CLI compile the multiple source files? Because the same partials could be shared among source files, and if the CLI calls the compiler separately on all of them, we will be re-reading files unless if there is a global structure storing the document trees
.clv.html
and the files to be compiled were .html
?1.) I like this. Not too crazy about the double file extension, but I think it's a good way to make a distinction between the two types of "html" users will be writing when using this tool and maintaining the syntax highlighting expected when writing html. I think restricting users to have their cleaves and source pages within specific folders might be too restrictive.
2.) Should be fairly simple to have the compiler return a list of compiled cleaves (.clv.html
) that were generated for a single source file and keep appending the newly generated cleaves within a list maintained by the CLI. Each time the compiler is called the CLI would pass this list of cleaves and the compiler will use these as needed.
what if you have the main pages be .html
and the partials be .clv.html
?
There is a difference created between them, as well as a specific extension for the cleave files
Okay, here's how I see someone using this tool through the CLI
Here's a sample project directory structure as an example
Here are a few use cases for the CLI:
cleave src/input1.clv.html
Either outputs to stdout (to be piped) or writesinput1.html
in the current directory. If we have it output to stdout, it's not really consistent with anything else here.cleave src/input1.clv.html out/index.html
ORcleave src/input1.clv.html out/
Writes out the output toout/index.html
or out/input1.html`, respectively.cleave src/
Outputs puts all output in current directory, with the same file names but an.html
extensioncleave src/ out/
Every.clv.html
file in input is transformed and output with the same name in theoutput/
directory, as they are above.cleave src/ output.html
This is an error. You can only specify the name of the output if the input is a single file.A couple of other things:
render(<cleave html>, <some sort of output or file printer>)
function