krasimir / techy

A flat file CMS based on Gulp and AbsurdJS
http://krasimir.github.io/techy
MIT License
250 stars 23 forks source link

Do we really need themes? #23

Open ismay opened 10 years ago

ismay commented 10 years ago

When using techy I personally feel that the themes aren't needed and only add complexity. I've never switched themes during a project and always just develop with a single theme.

To me it makes more sense to remove the themes option from techy. It feels a bit like a wordpress remnant. For wordpress users themes make sense, since a wordpress network install can manage multiple sites at once and you would need multiple themes. But a single techy project does not have to manage multiple sites at once and on one website you can only use one theme at a time.

Jekyll for example, which is very similar to Techy and used by Github pages, doesn't use themes and it is one of the most popular flat file cmses.

I think Techy would be easier to understand, easier to use and easier to maintain without the themes option, and that it wouldn't harm the functionality of techy. In fact, I think techy would become easier to use since there would be less configuration required.

ismay commented 10 years ago

I hope you don't mind me posting these issues. I think Techy is a wonderful project and think this would make it even more awesome!

krasimir commented 10 years ago

Of course I don't mind posting issues. It's really great that you are rising discussions.

The themes in Techy are build mainly to hold the default assets and templates. Even if we remove the term themes we will still need something which is copied to the project's folder and contains the .html, .css and .js files. Another reason for having themes is that I wanted (in the beginning) to create different looks of the default design. Like for example dark, light or blue versions.

Let's keep this issue open and see if other developers share the same opinion.

from a technical point of view will be a little bit difficult to remove the themes concept

ismay commented 10 years ago

Of course I don't mind posting issues. It's really great that you are rising discussions.

Ok cool, I'm glad you feel that way!

Another reason for having themes is that I wanted (in the beginning) to create different looks of the default design.

I think that that is something better solved with css preprocessors. For example, you could have sass variables for your colors, and by changing them in one place (with darken() or lighten()) it would be trivially easy to change the look of your entire site. This also creates a better separation of functionality since that way css is solely responsible for the style/layout and techy is responsible for the content management.

Even if we remove the term themes we will still need something which is copied to the project's folder and contains the .html, .css and .js files.

We could take a note from the way Jekyll does it for example. With them every folder that is prefixed with an underscore (like _includes, _layouts) is a source folder which is not copied, and every folder that is not prefixed is processed and copied to the _site folder.

So when we apply this to Techy, this would mean you could simplify a Techy project to the following layout:

/techy-project
    /_partials
    /_layouts
    /_dist
    /css
    /js
    /img
    /blog
        /blog.md
    index.md
    TechyFile.js

With this structure Techy would process all folders without an underscore prefix (in this case css, js, img, blog) and copy them to /_dist. All folders with an underscore prefix are Techy system folders (so _partials contains partials, _layouts contains layout templates, etc.) and are used for generating the content.

So this way, the result after running Techy would be:

/techy-project
    /_partials
    /_layouts
    /_dist
        /css
        /js
        /img
        /blog
            /blog.html
        index.html
    /css
    /js
    /img
    /blog
        /blog.md
    index.md
    TechyFile.js
krasimir commented 10 years ago

Hm ... the idea with the underscore is good. I'll see how complex is to make Techy work like that.

Something else which I'm worry about right now. If there are developers using Techy switch to a newer version the differences will be a lot.

ismay commented 10 years ago

Something else which I'm worry about right now. If there are developers using Techy switch to a newer version the differences will be a lot.

That's true. In my opinion this is worth it though. Also, it would be easy to switch the source files from a techy project with themes to a project without themes, and if it is a dealbreaker they could always install an legacy version of Techy that still uses the old layout with npm install techy@version.

the idea with the underscore

Another small advantage of this is that there are no more reserved folder names. Currently you cannot have a themes folder in your techy website because that is already used by techy itself (so www.mywebsite.com/themes/index.html isn't possible if I understand correctly). Separating website folders from techy folders with the underscore solves this problem and means basically all folder structures are possible.

krasimir commented 10 years ago

Good points. I'll work in this direction and very soon will release a new version.

krasimir commented 10 years ago

It's done. Much much simpler and indeed looks better. Try out the new 1.1.3 version.

ismay commented 10 years ago

Cool, looks good! I've tested it and a couple of things caught my attention when using the new version with the default settings:

I'll try it out some more and let you know if I find anything else. My compliments on the fast updates!

krasimir commented 10 years ago

Thanks for the feedback. I didn't prefixed the dist folder for some reasons, but can't remember them now :) The _css and _js folders are actually system folders. I mean if you put several files in _css they will be concatenated. It's the same with the .js files in _js directory. My idea was also if the developer wants to use Sass to put the .sass files in _css.

I leaved the public into the root, because I wanted to give possibility to the developer to store there things which should go to the dist folder. But now I think that I have to change that, because the users could place such resources directly into dist/public.

ismay commented 10 years ago

The _css and _js folders are actually system folders. I mean if you put several files in _css they will be concatenated. It's the same with the .js files in _js directory. My idea was also if the developer wants to use Sass to put the .sass files in _css.

Ok, I understand. I do think that that makes the whole structure more complex than it needs to be. The automatic compilation and concatenation of css and js is a nice feature, but I would decouple it from the basic static site generation for clarity.
It would be simpler if all folders without _ are copied straight to _dist with only these operations:

That way you can use a css, img, js or whatever folder and they will all just be copied with everything in it. Then later on you could add logic for concatenation and sass or less compilation, which I think should be optional, not defaults (I would leave the selection of a preprocessor, concatenation, etc. to settings in TechyFile.js, users can set a preprocessor and folders there).

I leaved the public into the root, because I wanted to give possibility to the developer to store there things which should go to the dist folder.

If you copy all folders without an _, the public folder isn't necessary. The dev can just use whatever folders he or she wants.

But now I think that I have to change that, because the users could place such resources directly into dist/public.

Usually the _dist folder only contains generated content, and isn't touched by the user directly. If you copy all folders without a _ prefix users can add content just by creating folders without _ and putting stuff in there. You could ignore all systemfolders with !_**/*, or something similar.

krasimir commented 10 years ago

Good points. The next week is kinda busy for me, but will try to find some time to optimize Techy according your suggestion. I really like the idea to remove the default CSS and JavaScript concatenation and move such features to the TechyFile.js.

ismay commented 10 years ago

All right, take it easy and I'll be glad to help test any changes!

krasimir commented 10 years ago

Hey, there is 1.2.0 released. It now works as we discussed here:

  1. There is no CSS or JS preprocessing
  2. It creates a _dist folder where it puts the final files
  3. It simply converts .md to .html files based on the Techy logic known so far
  4. Copies all the folders that doesn't start with _
  5. I leaved an option for themeing. However, this is turned off by default. If the developer adds theme: 'default' to his TechyFile.js he will get the basic styling which is used so far.

So, thanks for the feedback. It looks much cleaner now.

krasimir commented 10 years ago

1.2.1 is released. It contains a fix for the non-working watching of files + javascript concatenation option in the TechyFile.js file.

ismay commented 10 years ago

I tried updating to 1.2.1, but got the following error:

npm ERR! Error: shasum check failed for C:\Users\Admin\AppData\Local\Temp\npm-2140-wuNx4m1K\1402316390864-0.35977678070776165\tmp.tgz

Is this a problem with Techy, or is it on my side (I'm on windows btw)?

krasimir commented 10 years ago

I'll fix that today (probably). Till then you can use:

npm install -g https://registry.npmjs.org/techy/-/techy-1.2.1.tgz
krasimir commented 10 years ago

Can you please try again with nipm install -g techy. I just released a new version 1.2.2 from my virtual box and it should work.

ismay commented 10 years ago

Apologies for my late reply, I was a little busy. I've updated to the latest version and tested it a bit:

So far it's looking good! It's really getting to be a lean, mean templating machine!

(By the way, it looks like you uploaded a vim swap file package.json.swp accidentally with commit 71d73acba56965364b56b4e68c4e267263dea135.)

krasimir commented 10 years ago

I did find that folders prefixed with an _ weren't ignored as they should be, instead they are processed and copied to dist.

I'll check that. It is probably a bug.

Folders without an underscore prefix were copied to dist, which is correct. I tested with a js folder, which contained sample.js. After running techy it was copied to _dist, but when I updated it, techy didn't update the file in _dist. Only after stopping techy and running it again did it update _dist/js/sample.js. I guess that by default it isn't watching all files, but only .md?

The watching is now available only for the .md files. The CSS and JS is now optional and needs additional settupping

Also, new files aren't processed automatically by Techy when it's already running, you have to restart it for that. But that is a known bug, right?

Yep, that's a bug.

ismay commented 10 years ago

The watching is now available only for the .md files. The CSS and JS is now optional and needs additional settupping

To clarify, I don't mean watching and compiling css/js. I mean just copying it to dist when something changes. Just like with images, or other files.

krasimir commented 10 years ago

I think that this is doable. Will thing about the feature too.

P.S. Thanks for the feedback ;)

ismay commented 10 years ago

:) no problem!

krasimir commented 10 years ago

1.2.3 version is released. The copying of the underscored directories should be fixed now.

ismay commented 10 years ago

Tested it and it works. Ignores underscored folders and copies all the others. Perfect!

krasimir commented 10 years ago

Great. I'll leave the issue opened. The watching and copy of the files seems like a complex task I'll probably need more time for that.