Skip to content
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

Generate a quick index.html with sakura loaded #11

Open
zhouzi opened this issue May 4, 2017 · 7 comments
Open

Generate a quick index.html with sakura loaded #11

zhouzi opened this issue May 4, 2017 · 7 comments

Comments

@zhouzi
Copy link
Contributor

zhouzi commented May 4, 2017

I like the idea of having a demo page/blog/landing page with little efforts. It would be even easier if we could just run sakura to create:

css/
  sakura.css
index.html

index.html would include a basic html structure with sakura.css loaded. It could do more than that though, for example:

  • sakura README.md - generate an index.html file with the html generated from the markdown file
  • sakura --theme light - generate html file with the light theme loaded

To accomplish that, the repository would just need to include a few js files. You can then declare executables in the package.json and publish them. Users could run npm install sakura --global and then sakura.

No need to lookup for the cdn url or download the css file. No need to create an index.html files with the basic structure.

Happy to submit a PR if that sounds good.

@zhouzi zhouzi changed the title Generate a quick index.html Generate a quick index.html with sakura loaded May 4, 2017
@purag
Copy link

purag commented May 4, 2017

This doesn't seem like it should be in the main repo. Sounds like it should be its own npm package, with a name like sakura-cli.

@oxalorg
Copy link
Owner

oxalorg commented May 5, 2017

This is a great idea. I've been using this in my shellrc (to convert from markdown) from quite some time now:

sakura () {
    pandoc --css /cabinet/lab/sakura.css/css/sakura.css $1 -o /tmp/$1.html
    xdg-open /tmp/$1.html
}

To make my life even more easier, I made smurf, which works with sakura (or any css really) quite well.

But I've got a few concerns with this:

  • I'm using pandoc in my small shell command, but I'm sure we'll have to include a markdown parser. Bundling a markdown parser with a css theme/framework sounds extremely unnecessary (and against the spirit of sakura)

  • No need to lookup for the cdn url or download the css file

    Though it sounds great in theory, it doesn't really save the user a lot of time. It adds a level of indirection, which is nothing more than copy & pasting 2 html tags.

  • When a user npm install sakura.css, why should they have to download a markdown parser, extra javascript files, and an extra command? I feel if they install .css, that is all they should get.

  • And lastly, there is nothing specific about the command line tool relating it to sakura. It can very well work with any other css framework/markdown files/html skeletons.

This doesn't seem like it should be in the main repo. Sounds like it should be its own npm package, with a name like sakura-cli.

This sounds perfect. If there is a need for a command line tool by the users, another repository named sakura-cli would be more appropriate.

Any thoughts? :bowtie:

@purag
Copy link

purag commented May 5, 2017

I think if you want to specialize the command line tool, you should make a full-fledged static site generator (like Jekyll) using markdown and sakura. Of course, the philosophy would be to keep it simple, so it would be ideal for 1-5 page websites.

You could have two primary commands, sakura run and sakura build.

run would run the website on localhost, rendering the .md files in the specified directory and using sakura.css, a lot like your project smurf.

build would compile the .md source files into a static site, also using sakura.css.

This way, sakura is the static site generator, and it uses sakura.css, which is just a plug-and-play CSS library.

In any case, whatever you decide to do, I'd be down to help develop it!

@zhouzi
Copy link
Contributor Author

zhouzi commented May 5, 2017

I agree that it shouldn't be part of sakura but published as a separate package like sakura-cli, as suggested by @purag. It doesn't mean it shouldn't be part of the main repository though, have a look at lerna. It's a tool that lets you manage separate packages in a mono repository.

Now, regarding the concerns you raised:

Bundling a markdown parser with a css theme/framework sounds extremely unnecessary

Solved if published as a separate package.

It adds a level of indirection, which is nothing more than copy & pasting 2 html tags.

Without the cli, you would need to:

  1. Create an index.html
  2. Inject a basic html structure
  3. Download/install and inject normalize.css
  4. Download/install and inject sakura.css

With the cli, you would need to:

  1. Run sakura

The first method saves me from writing some custom css. The second saves me from scaffolding a new project. The cli is definitely not a requirement but it'd probably increase the usage of sakura over time.

there is nothing specific about the command line tool relating it to sakura

You're right. But then you'd need to whether create an entirely new project (with the "marketing" efforts involved) or add support for a tool that is already adopted by the community. The latter would be a great solution. If anyone knows a tool that does that, I'd be interested.

Anyway, thanks for the interesting discussion 👍 It's just a suggestion after all so feel free to do what you think is best 😉

@oxalorg
Copy link
Owner

oxalorg commented May 6, 2017

The first method saves me from writing some custom css. The second saves me from scaffolding a new project. The cli is definitely not a requirement but it'd probably increase the usage of sakura over time.

Since I intended to quicken developer time (especially for people who just don't want to bother with css), it's a probably a good guess that they don't want to bother with HTML either. So if all the 4 steps you listed could get compressed down into 1 simple command, that'd be really really awesome!

I think if you want to specialize the command line tool, you should make a full-fledged static site generator (like Jekyll) using markdown and sakura. Of course, the philosophy would be to keep it simple, so it would be ideal for 1-5 page websites.

Another really awesome idea @purag ! Maybe we could combine both these scenario as follows:

  • sakura will simply do the 4 steps as described by @zhouzi and will be standalone (not requiring any specific directory structure).

  • sakura build can be used to create a website template directory like:

    $ tree .
    .
    ├── blog
    │   └── my-first-blog-post.md
    ├── build
    ├── pages
    │   ├── about.md
    │   ├── contact.md
    │   └── support.md
    └── static
        └── imgs
            ├── blossom.png
            └── cherry.png
    

    Keeping it really simple, and ready to publish within minutes (the feature would be to have less features? :P)

  • And finally sakura run will simply open the current folder on localhost.

Though some people will inevitably be dissatisfied with the static generator, given the simplicity of it. I'm sure it will appeal to a lot of people, just like sakura.css did 😊

If you guys are excited about any of this, I'm totally down to help and collaborate! ^_^

@purag
Copy link

purag commented May 7, 2017

If it's gonna be as thorough as that (making a blog directory, etc), it may be better to just ship it as a theme for jekyll, hugo, etc.

I think it might be nice to just have .md files in a directory and run sakura build to build a static site out of them. As in, start in a directory containing just index.md and about.md, and run sakura build to make the site, resulting in:

index.md
about.md
build/
  sakura.css
  index.html
  about.html

sakura build-dev instead of run might be better for running the site on localhost, from the same setup (just .md files).

There are lots of use cases for a static site generator without blogging capabilities. This would be awesome for github pages, as right now people are resorting to jekyll for that since github supports it, but maybe that's overkill.

@zhouzi
Copy link
Contributor Author

zhouzi commented May 7, 2017

Although I like the idea, I believe Jekyll and other static site generators would defeat the purpose of sakura. They're complex tools that add a level of abstraction that makes it hard to understand how everything works together.

It should be easy to understand and tweak the result of running the sakura command. I believe the simplest way to create a server would be to add an index.js (using express for example) along with the appropriate npm scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants