ashes999 / butterfly

Haxe generator for simple, static blogs.
28 stars 1 forks source link

"static website generator" and "flat file CMS" into the same codebase #9

Closed zaxebo1 closed 8 years ago

zaxebo1 commented 8 years ago

BACKGROUND: https://github.com/ludovicchabant/PieCrust "PHP" based static website generation and static CMS in one single codebase.

Later the author wanted to improve the codebase for asset pipeline , so he rewrote this software in python as Piecrust2 https://github.com/ludovicchabant/PieCrust2 http://bolt80.com/piecrust/ Python based - A simple yet powerful static website generator and lightweight CMS

Now, MY REQUEST: Can the butterfly be written in such a way that say, SCENE1) given a set of markdown files, i can generate the HTML etc files using buttefly and upload it to a webhost (even without support of any serverside language) for serving files. So it will behave like static website generator, just like Piecrust2 [ i understand that this^ can be already achieved in butterfly as on date]

SCENE2) The same butterfly written in haxe, can be compiled with haxe/PHP and then butterfly's PHP code itself is deployed on webhost which supports PHP. Now I need to just upload the markdown files only (not uploading the generated HTML files) on a cheap PHP webhost and it will be dynamically serving the markdown files. So it will behave as a simple flat file CMS, just like Piecrust2 [ This is not currently supported in butterfly, and this scene2 is the real request of mine ]

ashes999 commented 8 years ago

I'm not sure I completely understand what you're asking (for "SCENE2").

It sounds like you want a tiny PHP web application that:

Is that right? If so, that really has nothing to do with butterfly.

Let me put this a different way: why would you want PHP to dynamically serve the files? I can see some disadvantages:

Butterfly really works around all those problems by handling offline generation of the final HTML (as HTML: no CPU required to serve it up via PHP rendering). You can preview the files locally, upload them, and you're done.

Most PHP servers are Apache, and Apache certainly can handle static HTML. Is there any reason why you don't want to just buy cheap PHP web hosting, upload Butterfly files, and be done with it? (GitHub Pages also gives you free hosting for HTML files.)

If you want a web editor that can edit Markdown files, that's a different story. I would suggest using Butterfly with an offline editor (eg. Visual Studio has a plugin for rendering Markdown as HTML), verify the HTML first in your browser, then upload your files.

Am I missing something, or will this fit your needs? This doesn't require changing Butterfly's philosophy, which is to output simple HTML files for any static hosting.

zaxebo1 commented 8 years ago

Butterfly philosophy of outputting simple HTML files remains the same, if those generated HTML files deployed on webserver will work traditionally. the only thing "added" is that the "same source code" of butterfly/PHP when deployed on webhost can render the markdown at run time "dynamically" like flat-file-CMS.

That is the same code can behave like static website generator and also like flat-file-CMS(dynamically generating the view at runtime). This combines both the notions. This has been already demonstrated by Piecrust2 (and Piecrust) that same program can behave like static website generator and also like flat-file-CMS both.

So, implementation of flat-file-CMS does not take away its prior another functionality/mode of static website generation. Both the features/modes can co-exist with the same code, as demonstrated by Piecrust2

ashes999 commented 8 years ago

I think you can probably find existing libraries for this in PHP (rendering Markdown to HTML and caching it smartly), and handling routing (mapping URLs to markdown => HTML).

Such a solution would work well with Butterfly as well, although I have no interest in developing it personally.

zaxebo1 commented 8 years ago

ADVANTAGE: advantage is that if my team wants to just UPLOAD the generated HTML files, then they can just use ay server. BUT This will have to done everytime for the generated file. If i changed global footer , then i will have to upload all the re-generated HTML files. which is an issue (time taking /money taking - for very slow speed internet and very costly for our country, which internet is not cheap and not fast. Using direct web based editor on the cheap web host, to edit markdown files is also a major reason.

But if just markdown for footer is uploaded, then only one single file has to be uploaded on webserver and it will be dynamically served.

later if somebody wants to just host it on a simple web server for faster performance Then he can scale it by generating sites offline and uploading only HTML files

zaxebo1 commented 8 years ago

finally its your call, if you are not interested, then also no problem.

ashes999 commented 8 years ago

I don't think I understand. To me, the difference between uploading one markdown file vs. uploading a handful of HTML files is negligible. The complexity there is establishing credentials and creating a connection to the server.

Anyway, sorry, I'm not interested in writing something like this.

ashes999 commented 8 years ago

I thought about this more. I don't know much about Haxe to PHP, so you're on your own there. What I can suggest is using Butterfly classes (eg. Page, Post, ButterflyConfig, and LayoutGenerator) to do the "heavy lifting" of your site. The unit tests should give you a good idea of how these classes work.

To start out, you can add butterfly as a sub-repo, and if this turns out to be useful, I can publish it as a haxelib later.

Alternatively, I would seriously consider something like Grav

zaxebo1 commented 8 years ago

grav is just a PHP based "flat file CMS", but it is not "static site generator", which is a great disadvantage. grav advantage is the "optional" admin panel.

What i want is a single tool, which can act as BOTH the flat file cms and static site generator. Though Piecrust2 does that - but it is in python. If a 'HAXE' based tool(like butterfly) was capable of doing BOTH, then it wouid have been a real killer combination. So that its flat file CMS "mode" could support jvm web seervers using haxe/java, Apache using haxe/PHP, nodejs using Haxe/javascript.

zaxebo1 commented 8 years ago

but anyway, i will myself look into butterfly running dynamically via haxe/PHP as flat file CMS too

ashes999 commented 8 years ago

Butterfly was never intended to be a flat-file CMS; just a blog or static site generator.

If you are able pull this off, let me know, and I can link to your repo from the README.