
Wordless: stop writing Wordpress themes like it's 1998. - steffoz
https://github.com/welaika/wordless
======
ceol
I'm not a Ruby developer, so I can't comment if this makes it easier for
someone who lives in both Rails and Wordpress, but as someone who has to
occasionally make a custom Wordpress theme and has no experience in Rails,
this looks like a _lot_ of complexity just to put together a theme. However, I
could see this being very nice for someone whose time consists mostly of
Wordpress themes, and you obviously put a lot of work into it, so I don't want
to write it off. It's cool you were able to make such a feature-rich Wordpress
plugin.

Just to make sure: the production/live machine doesn't need the Wordless
plugin, correct? Basically you use the Wordless plugin on the dev machine then
just distribute the created theme directory like normal? Or am I off-base?

~~~
steffoz
ceol, that's almost correct. you need to keep the plugin also on your
production server, but the compiled assets gets "baked", so wordpress just
serves static files.

~~~
ceol
Gotcha. Thanks for your reply. Do you have any plans to include some sort of
"conversion" functionality that turns Wordless themes into standalone themes
that dont' require the Wordless plugin? I could see a lot of people who make
and sell Wordpress themes using this like crazy, but the dependency might turn
away most of them.

~~~
steffoz
Well, there's not a "conversion" tool in the near roadmap. But you can
somewhat easily drop this plugin inside a theme, require it and bundle
everything together.

------
lux
This seems like an awful lot of extra layering on top of WP's horribly ugly
theming system... And adding Ruby as a requirement? What about building on
PHP-based tools like Assetic, or a cleaner template format?

<https://github.com/kriswallsmith/assetic>

I've never understood why people were willing to jump through so many hoops
building themes in WP's messy way.

As a comparison, here's a complete theme (based on the Twitter Bootstrap
toolkit) for my current PHP-based project (self-promo, but illustrates the
difference well IMO):

<https://github.com/jbroadway/bootstrapped>

One HTML file, Bootstrap + one short CSS file, zero mixing of PHP code. Most
WP alternatives offer similar theming, either Mustache-based like the above is
based on, or Twig, both of which are much much cleaner options IMO.

~~~
ggwicz
It's not a horribly ugly theming system.

I'm mainly an HTML and CSS guy, and know a healthy amount of PHP.

But I _don't_ know enough to set up a server, databases, write a CMS from
scratch (well, maybe I could), and I don't like spending a lot of time in the
Terminal. I'm not a programmer.

Even as a designer, I'm able to use WordPress' _powerful_ theming system
(which is pretty easy to understand and, in my opinion, not ugly at all) to
build out an entire easy-to-use site for a client without having to also hire
a developer. The WordPress community is massive and helpful, PHP is well-
documented and simple to work with if you know HTML, and you can literally use
WordPress to make almost anything on the web. Maybe it would be better
theoretically to hire a developer or learn to be one, but I don't like
hardcore programming and sometimes just don't need a developer that I have to
pay for, wait for, etc.

WordPress, in a way, makes the ability to make simple web apps, dynamic sites,
and blogs a more democratic thing; many people can pick enough WP knowledge in
a few weeks to do things that would take months or years of programming
training.

~~~
ra
From the point of view of an experienced software developer, writing a
Wordpress theme is an ugly job because the Wordpress API is inconsistent,
incomplete and badly documented.

------
yaix
>>Ability to write PHP code using the beautiful Haml templating system;
>>Ability to write CSS stylesheets using the awesome Sass syntax [...];
>>Ability to write Javascript logic in Coffeescript;

Some may like that, but I want to write my PHP in PHP, and write my CSS in
CSS, and write my JS in JS. I really never got why I would write one language
in another language just to then use some tool to translate it (and if it gets
a little complicated have to manually fix translation problems afterwards).
Can someone explain please?

~~~
rlander
"I really never got why I would write one language in another language"

The terser the syntax, the less room for error in comparison to its more
verbose counterpart.

"just to then use some tool to translate it (and if it gets a little
complicated have to manually fix translation problems afterwards)"

If you're manually fixing compiled code, you are doing it wrong.

~~~
wladimir
Exactly, using higher level languages is a matter of DRY (Don't Repeat
Yourself) and normalization (specify things in one place, have them change
everywhere consistently).

Especially for CSS this is really useful as in itself is a crude, low-level
language, things can quickly become very verbose especially if you consider
cross-browser compatibility for the fancier effects.

------
jonknee
If you're going to use all the new hip tools (and take the time to learn how
to use them), just go one step farther and stop using Wordpress.

~~~
patio11
Wordpress is _far and away_ superior to any blogging platform available on
Ruby. It makes _wonderful_ sense to write Wordpress templates in a somewhat
more productive environment than raw PHP, then compile them down into
something which requires no dependencies on the actual server. This gets you
all of the many, many benefits of Wordpress (great plugin support! huge
community! deploys at any commodity web host! SQL vulnerabilities patched
weekly+!) while having your template development not hindered by copious
amounts of spaghetti code.

It is also big news to folks who write a _lot_ of templates, because something
like this allows them to create a toolchain which spits out WP templates, as
opposed to having to e.g. having a template framework that templates are built
against. This means that they can do across-the-board updates much more
easily. That's a huge win if, for example, you're a company that publishes
100+ templates and somebody reports an XSS vulnerability in a commonly
repeated component of one of them. (I don't know if their other 99 templates
are patched yet so I won't go pointing fingers, but suffice it to say this
happened.)

\+ Kidding, kidding. OK, _mostly_ kidding.

~~~
steffoz
That's pretty much the spirit of the plugin :) thanks

------
MattBearman
I feel this is solving a problem that doesn't exist.

The problem with creating a WordPress theme isn't that it's missing buzzwordy
tech like HAML, SASS and CoffeeScript. The problem is that the PHP behind
WordPress is hideous. Even in version 3.x

If someone were to fork WordPress and fix all the spaghetti code, then I could
stop writing themes like it was 1998...

~~~
bobds
I've dived in the Wordpress codebase a few times, I think it wouldn't be very
hard to rewrite major parts. However, I don't think you can fix much without
breaking tons of plugins, themes and 3rd party tools that integrate with
Wordpress.

And if you are going to break the plugin ecosystem, might as well use Habari,
which is much nicer: <http://habariproject.org/en/>

Too bad all the available plugins fit in a single page:
<http://wiki.habariproject.org/en/Available_Plugins>

~~~
imperialWicket
+1 for habari, although lack of plugins is a bit of an issue when it comes to
sites that need a lot more than just blog + static pages.

------
tibbon
This is awesome! I've often lamented how messy Wordpress is compared to Rails.
Yet, there's nothing as mature and easy for anyone to use as Wordpress in
Rails.

~~~
j45
Rails is a framework, while frameworks do cool things, developers in any
language are not always out to build a piece of software that's like a swiss
army knife like Wordpress.

The rails communitys' exuberance to simplify and automate everything in sight
hasn't quite reached wordpress yet. In the mean time there's gems, I guess.

~~~
tibbon
I guess I was just thinking of rails very clear MVC pattern. Wordpress doesn't
have this at all. Instead they have "the loop" which just ends up being a
mess.

~~~
j45
Yeah, Rails is one of many recent MVC patterned frameworks. It wasn't the
first, and it won't be the last.

WP was created in a time where I think switches were used more.

Personally I find the MVC paradigm to apply to web apps easier, but there was
a time when web apps maybe weren't so complex, and WP was around a long time
ago.

Still, nothing provides a compelling ecosystem as Wordpress out there, so we
can say the language, coding style seems to only matter so much in the end.

------
steffoz
I would love to hear some comments from you. I think this really speeds up
custom Wordpress theme creation.

~~~
utkarshkukreti
Does this plugin generate standalone themes or do they depend on the plugin?

~~~
steffoz
Wordless, at its core, is just a big set of helper methods, plus a way to
compile SASS/Coffeescript without the need to open a terminal, plus the
embedded Phampl library to write views. So yes, the theme depends on the
plugin, just like any other Wordpress plugin.

------
josefresco
Looks like a whole bunch of stuff I'm not sure anyone (WP theme devs) was
asking for. Cool project though, I'm just not sure the added layers really
benefit developers much who are already used to the current system.

------
pseudonimble
I've got a feeling most people writing Wordpress themes wont meet the
requirement of having Ruby installed.

~~~
blacksmythe
This was built for the people that do.

------
dangrossman
Shouldn't that be "stop writing WordPress themes like it's 2003"?

~~~
hoop
I clicked "comments" _hoping_ to see this

~~~
steffoz
lol, yeah. That makes more sense, thanks :)

------
ggwicz
Jesus Christ. Can we stop all this "PHP Sucks" nonsense? We get it, a language
like ruby is better for _you_. And hell, there's not much of an argument
against how PHP looks; Ruby and Python, to me, look much much nicer.

But complaints about its technological capability are completely false. It's
super easy and simple to learn, and even a HTMl/CSS guy like me is able to
build pretty powerful, dynamic websites and simple apps with WordPress and
(gasp!) PHP.

Before you start shitting on PHP, realize that a) you're arguing over a
programming language lol b) it's been around for a long time and thus has a
huge community, good documentation, lots of books and resources, and comes
preinstalled on a lot of servers, etc, c) great applications like MailChimp,
Wikipedia, Digg, and FaceBook use PHP extensively d) the learning curve is low
e) yeah, it is ugly. But its easiness to learn got me into quasi-programming
with WordPress, and since seeing .rb files I've begun to get curious about
ruby. But the basic programming knowledge is there from PHP experience and
facilitates learning other languages.

Sorry, it's just frustrating to see people making fun of a language and
criticizing the people who work with it.

------
csomar
Cool. As someone doing heavy WordPress development (and will be doing even
heavier dev. in the future) this is a step in the right direction.

The available tools for WordPress right now are just awful. I'm doing plugin
development right now (but will get to themes in a couple of months); and in
order to setup unit testing it took me a full 3 days.

When coding plug-ins, I noticed that I'm using awful and very old patterns
(like mixing PHP with HTML). It's like I'm working on PHP when I was 15 years
old. Checking a few WordPress plug-ins (popular and premium ones), it even
proved to be worse: They were using procedural code and patterns. Huge and
long code, a bunch of functions with long names binding to WordPress actions
or filters.

Here are the improvements that I'm looking for (and working on):

1\. Better Unit Testing: A better stack for Unit Testing.

2\. Better debugging: Debugging is just a nightmare when doing WordPress
development and your project (I'm using Netbeans) should point to your plug-in
repository.

3\. Developers plug-in: A plug-in to manage your WordPress install

4\. Bootstrap plug-in: Administration interfaces
(styles/tables/forms/buttons...)

EDIT: I just noticed that the following

    
    
      Include the assets in your Haml views using include_javascript() helper.
    
      = include_javascript("application")
      This will produce the following HTML, pointing to the assets/javascripts directory:
    
      <script src="/wp-content/themes/YOUR_THEME/assets/javascripts/application.js" type="text/javascript"></script>
    

This is a very bad practice. You should use WordPress functions to queue
scripts and styles.

------
wooptoo
> Ability to write Coffeescript instead of the boring, oldish Javascript;

stopped reading right there.

~~~
steffoz
Thanks, removed that point, maybe that was too much :) Also, Coffeescript is
totally optional in Wordless. There's Sprockets under the cover, so you can
write JS just fine, with the "//= require" directive bonus.

------
JonnieCache
LOL.

Why not just go the whole hog and run wordpress _inside_ ruby, using
tenderlove's Phuby bridge/adapter/thing.

<https://github.com/tenderlove/phuby>

Demo of him actually using this to run wordpress inside rack:
<http://www.youtube.com/watch?v=MXERy8Y2eVo>

Or, you know, spend a day knocking together your own blog in rails.

I guess it could be good if you are wedded to a preexisting client base which
demands wordpress, even for new projects, in which case my sincerest
condolences go out to you.

To be fair, I'd imagine that those people who are raking in big $$$ doing WP
themes must have something like this set up already.

~~~
steffoz
I'll quote Wynn Netherland on a post about his take on the very same problem:

"I'm a Rubyist. But I'm also a pragmatic front-end developer. When I have to
write a full-stack solution, I pick Rails or Sinatra because writing Ruby is a
joy and the Ruby ecosystem is so darn cool. But when I have to create a CMS-
based site for myself or a client I love the usability and community behind
WordPress. Although I can reluctantly lay Ruby aside when I extend WordPress,
I really miss my syntactically awesome stylesheets. Until now."

[http://wynnnetherland.com/journal/sass-up-your-wordpress-
the...](http://wynnnetherland.com/journal/sass-up-your-wordpress-themes-with-
compass)

------
egypturnash
This is... impressive.

Not for me, though. When I got my current webcomic up and running I didn't
even bother writing a custom theme like I did before - I just made a child
theme of the Comicpress theme and started hacking away at the CSS.

It is inefficient, it is inelegant... but I got it up and running in a couple
of days rather than a couple of weeks of tweaking the hell out of everything.
Every now and then when the comic's being hard to write I procrastinate by
tweaking the theme a little more.

I don't know if this means I'm a talentless hack or a pragmatic professional.
Maybe some of both.

Then again I'm also not doing a crazy dynamic site that happens to be using
Wordpress as its backend.

------
darksaga
Although I've built WP themes and have "dabbled" in Rails (building a blog
like everyone else) and consider myself more of a front-end guy, this seems
like overkill to me.

Not to mention most designers I know would look at this and roll their eyes.

~~~
steffoz
I agree with you darksaga. This plugin is not for every designer out there,
and it's way too difficult for a PHP newbie. But, for people who already know
these languages, it's an incredible timesaver. So that's its target.

------
lkrubner
I appreciate the work that must have gone into this, and it looks like it has
been done well technically. However: How many people are this deep in the
world of Ruby and yet also enjoy writing WordPress themes? I run a forum
devoted to WordPress, and I can not imagine any of the experts (who post
there) wanting to switch over to Haml or Coffeescript. Most people who use
WordPress are either designers or programmers who are looking to put up a
somewhat quick-n-dirty CMS.

If you have the skills and resources to install a Ruby environment and a bunch
of gems, why not use Rails plus some CMS built with Rails?

~~~
asmala
I can only present anecdotal evidence here but I do most of my freelance web
dev work in Rails but turn to WordPress for web _sites_. I'm definitely more
conversant in Ruby than PHP, but I think the ecosystem of the WordPress
platform, plugins, and developer mindshare is a big deal for the projects'
futures.

That said, I don't see myself using Wordless. Aside from my personal gripes
with HAML, I have some concerns about breaking WordPress and PHP conventions.
Will future developers be able to continue my work? Will plugins work as
expected? How about page templates?

I did use SASS for a couple of themes and that worked out well enough, but I
doubt I'll use it for future projects. Idiomatic code and tools are a bigger
productivity boost both for myself and others.

EDIT: I can see a sweet spot for this in teams that work primarily with
Ruby/Rails but want to leverage WordPress on a site they maintain in the long
term.

------
deepkut
Interesting concept, but like others have said, I'm not sure if you're
catering to the right crowd. I've taken a handful of computer science classes
and am a web designer at heart, yet even I would not be very inclined to use
this. I would rather do it from scratch if I'm interested in learning these
newer languages like CoffeeScript. Wordpress is more for those who don't know
anything and/or want to build a semi-customizable blog/website quickly.

That being said, this is a fantastic project and I applaud you for doing this.
I hope those who do use it end up enjoying it.

------
pavelkaroukin
I was wordpress hater for two reasons - messy templates and messy plugins.
This hate came from my "consulting" days when I often had to fix and add more
features to existing wordpress websites.

Nice to see someone investing time into building rigid structure for
templates... (Although it looks like a bit too much for me :)) But probably it
worth learning Ruby, Haml, Sasl, coffee-script, etc)

Now if someone could come up with something very defined for plugins and make
somehow all "wordpress programmers" use it for both templates and plugins -
word could be better :)

------
keeptrying
What I really want is to be able to download a word press theme and have it
magically applied to my rails app or have some plugin that let's me do this.

------
ricardobeat
I was expecting something more lightweight. The dependency on Ruby and HAML is
a buzz killer.

------
kmg
Another project similar to this is Forge <http://forge.thethemefoundry.com/>
Embracing Sass, Less, CoffeeScript is not a bad idea for wordpress themes if
you are familiar with them.

------
dave1010uk
For those of you who want to use modern PHP with WordPress, there's Wordpress
MTV: <https://github.com/newsapps/wordpress-mtv>

~~~
audionerd
Looks great! Thanks for the tip.

I thought I'd mention, for those who prefer a modern Ruby stack, it is
possible to install a JSON REST plugin for Wordpress (like
<http://wordpress.org/extend/plugins/json-api/>) on the back-end, and write
your front-end display layer in Ruby.

------
pan69
"1. Your development machine needs a ruby environment"

C'mon. All this work and no PHP/Wordpress developer that will ever use this.
What a shame.

~~~
endorama
I'm a PHP developer and use HAML and SASS in PHP projects.

Why? Because to build a website with these tools speeds up my development
time. You cannot forget anymore a </b> closure. You can forget all the 'echo'
calls. You can forget all that horrible "nested" css rules with tons of
repetition. You can forget all that <?php ?> tags everywhere around the HTML
code. Yes the cost to pay for this is ruby. Well, it took me about 20/30
minutes to setup a ruby environment with RVM (
<https://rvm.beginrescueend.com/> ).

Now my PHP project are cleaner, easier to mantain, only with a little "trick":
some really good Ruby tools... At the end, I think that the advantages are
worth the costs...

This is a "templated" way to do so in wordpress projects... Why not? ^^

~~~
pan69
I'm not referring to HAML and SASS, I'm referring to Ruby.

HAML and SASS are good thing and to integrate it with Wordpress is great.
However, if you want Wordpress developers to make use of your efforts, cut the
dependency on Ruby since no Wordpress developer will be willing to get up and
running (or even installing) Ruby.

------
robertp
This could be great for WPMU devs/admins that want to be able to have a lot of
unique themes to offer their users.

------
pale_rider
All credibility was lost when I read Wordpress.

#capitalPdangit

~~~
MartinCron
Wordpress is the worst blogging system out there, except for all of the
others.

~~~
benatkin
The comment you're replying to isn't making fun of WordPress. The WordPress
community has this bizarre obsession with getting people to capitalize it the
way they want them to.

[http://www.wptavern.com/automatically-correcting-the-
wordpre...](http://www.wptavern.com/automatically-correcting-the-wordpress-
mistake)

~~~
MartinCron
I stand corrected. Thanks for sharing.

------
mat_jack1
awesome!!!

------
Arkh4m
This looks really like what I needed, it looks awesome!

------
PLejeck
This nearly made me sick. Yes, let's use RUBY to generate our PHP. That makes
loads of sense.

Then you said HAML, and I giggled.

Then you said SASS, and I started cackling.

Then you said CoffeeScript, and I nearly died of laughter.

Keep your Rubyist junk out of my (unbeloved) PHP.

~~~
daeken
You know that _you_ don't have to use it, right? Just want to make sure...

~~~
wwweston
It would probably help if the introduction to the project ("stop writing
themes like it's 1998") could manage to be a little more matter-of-fact about
the advantages it might have to offer and maybe a bit less opinionated.

