welaika / wordless Goto Github PK
View Code? Open in Web Editor NEWAll the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Home Page: https://www.wptools.it/wordless
All the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Home Page: https://www.wptools.it/wordless
This is a followup to my previous post. I cannot get wordless working with rbenv. I followed the instructions but when wordless trying to process the assets is cannot run the executables. Any advise on this would be great as I have had my site built for a month and get get it working with wordless!
The query_helper
function latest_post_of_category()
does not return last post by date, as the query is done with ASC ordering parameter which return always first edited post instead of last edited one.
Fix:
<?php
function latest_post_of_category($category, $post_type = 'post', $taxonomy = 'category') {
return latest_posts_of_category($category, 1, 0, $post_type, $taxonomy, 'date', 'DESC');
}
Probably this applies to latest_post_of_category()
to.
how do i add a class or id to a tag, such as link_to? i've tried variations such as:
link_to('link', '#', class="classname")
link_to('link', '#', {:class => 'classname'})
link_to('link', '#', ".classname")
link_to('link', '#', "class='classname'")
nothing seems to work.
Hello
So i setup all like in the readme description. MAMP is also running for Apache and the Mysql, but it doesn't work,
the Sass- or Haml-files are'nt compiled, it even didn't builds any of the preset CSS.
Any Idea where's my mistake?
Greetz
Some people prefer using LESS than SASS/SCSS. Since the Wordless preprocessor system is built in a way that makes it easy to add new preprocessors, why not add a LESS preprocessor? Example code for such a very basic LESS preprocessor can be found here: https://gist.github.com/1924883
Not sure if this is the right place to ask. I'm brand new to Github :)
I've found that using WP_Query to query the database leads to easier management than query_posts() as does not interfer with the main WordPress loop and does not modify the global WP_Query object, expecially if you need multiple loops, one inside the other.
I'm not sure that using WP_Query instead of query_posts everywhere is equally apreciated from all Wordless users.
I'd like to have some feedback about this. In my last project I wrote wp_reset_query() 2/3 times per view, and that leads me to this conclusion.
Maybe could be great if there is a Wordless option that lets you specify this?
Up to now to deploy a Wordless theme you need to get manually the compiled assets.
Is possible to handle the final build in a better way, to easy the deploy process.
In config/initializers/wordless_preferences.php, line 8
Wordless::set_preference("css.output_style", "expanded");
But the css.output_style option is completely ignored by compass, which renders files always with :compressed style.
Wordless pass the correct variable to the Process class, but for some reason the execution do not follow the setting.
When I place fonts inside of <my theme>/assets/fonts
directory and reference them in my stylesheet, when I inspect Firebug's NET tab, I get the WordPress custom 404 page as the SUCCESS response, instead of the actual referenced font.
If I remove the font altogether from the directory, I get an actual 404 ERROR response.
In other words, it seems that the referenced font is located when present, but somehow it's not being recognized a font.
Perhaps I've found a bug, or just need some assistance with setup.
Thanks,
Vic
Hello I would like to know how to setup Options Framework with WordLess ?
I tried to put the options.php in the config/initializers, but I have the same message in wordpress admin
"Your current theme does not have support for the Options Framework plugin. Learn More | Hide Notice".
Also for example if I'm working on a WooCommerce theme, where I would had to put the woocommerce (template folder) in my WordLess theme ?
(The new structure of wordless is still a bit strange for me)
Otherwise Wordless is great !
I've been using wordless successfully on a server with ruby. I then pushed to my production server (as PaaS server which does not have ruby installed at all). I cannot see the static assets, like application.css.
I am seeing this error on my pages:
body::before { content: "The path /home/vagrant/.rvm/bin/wordless_compass doesn't seem to be an executable!"; font-family: monospace; }
How do I test to make sure static assets are compiled on my staging server? What should I check into my git repo?
I've seen short opening php tags <?
, which could lead to crash on windows platforms.
Found in helpers/error_template.php
.
I've seen short opening php tags <?
, which could lead to crash on windows platforms.
Found in helpers/error_template.php
.
it looks like render_partial doesn't accept local variables right now. it would be great to add that capability so that it works like rails.
As http://wordpress.org/news/2011/12/wordpress-3-3-rc3/ this is the last pre-release
Can be a good idea to add a default 404 view to the vanilla theme.
I know Wordless is meant to be an opinionated plugin, but would there be any objections to making Haml optional, just like Coffeescript?
With assets cache enabled if you include more than one css in the page only one css is returned.
Example of this behaviour:
In _head.haml
I have:
<?php
= stylesheet_link_tag("bootstrap")
= stylesheet_link_tag("screen")
Both are compiled correctly in the tmp folder, but if I click on bootstrap.css link and on screen.css I get the same file content ( which is the content of the bootstrap.css file, as it comes before the other... )
I found a workaround:
To prevent this behaviour you must DISABLE assets.cache_enabled:
<?php
Wordless::set_preference("assets.cache_enabled", false);
It should work but it's worth the look
I would like to use page templates placed in the views folder. It seems like WordPress bypasses index.php when using page templates so we need to have a workaround.
Now is not possible to pass variables to render_view()
in the same way we can do with and render_partial()
.
I think would be useful to edit render_view()
to accept a $locals
array and pass it to render_template()
:
<?php
function render_view($name, $locals = array(), $layout = 'default') { ... }
The same thing could be done to yield()
.
Hey man. Hopefully it's alright for me to ask here.
Can we get a little bit of guidance on how to set Wordless up to use Less?
I feel like I did it correctly but it's not working.
Do we set the 'assets.preprocessor' to:
"Wordless::set_preference("assets.preprocessors", array("SprocketsPreprocessor", "LessPreprocessor"));
Should the compass lines be commented out?
Do we have to edit less_preprocessor.php at all? Or we can just set the path in the wordless_preferences.php file?
Sorry for the newb q's. I'm not the strongest ruby dev ever so I may be overlooking some glaring issue.
But this is an amazing piece of software, and I'm on a mission to make it work. Would appreciate any bit of guidance you can offer. I searched everywhere but wasn't finding anything except the pull request pages etc.
Thanks so much!
I found it hard to understand which version of wordless I'm using. This cause some trouble due to the fact that the master branch changes frequently and is difficult to follow code changes, in particular is difficult to get documentation for older versions.
I think would be better if every significant commit pushed to master creates a new version, have his changelog publicly available and that the version is clearly specified in documentation/code.
Not sure how to move here, let's consider some options.
Add a folder inside config/ called environment in which specify configuration for different state of the theme ( development, staging, production ).
A doubt: what is the best way to load the proper environment file?
I've been playing around with adding a new preprocessor for LESS files. This got me thinking about how best to specify which preprocessor should be used for each type of asset. I imagine this would be a preference you could set in theme/config/initializers/wordless_preferences.php, but what would be the preferred way of specifying the processors?
Wordless::set_preference("assets.preprocessors", array("SprocketsPreprocessor", "CompassPreprocessor"));
Wordless::set_preference("preprocessors.css", "CompassPreprocessor");
Wordless::set_preference("preprocessors.js", "SprocketsPreprocessor");
Wordless::set_preference("css.preprocessor", "CompassPreprocessor");
Wordless::set_preference("js.preprocessor", "SprocketsPreprocessor");
I've been using wordless on a few projects already and really enjoy it.
There are some things that are bothering me however.
index.php:
if (is_paged()) {
render_view("posts/archive");
}
posts/archive.html.haml:
- $page_num = get_query_var( 'paged' )
- query_posts( "posts_per_page=2&paged=$page_num" )
- while (have_posts())
- the_post()
%li= render_partial("posts/post")
This is not the most complex code, but it would've been nice if some of Wordpress's default behavior would prepare this bit for us.
However, I encountered a more complex problem when I had to do pagination for date archive (i.e. /2012/05/23/page/2), neither is_archive(), is_paged() or is_date() returns true in this case, maybe there's another Conditional Tag that I should be using here, but I have yet to find that out.
What would a possible workaround be?
The arguments order in DateHelper::time_tag() is wrong: now the code is
function time_tag($date_or_time = NULL , $text, $attributes = array()) {
In this way the first optional argument is useless, because $text needed to be specified every time.
The best way to do this is:
function time_tag($text, $date_or_time = NULL, $attributes = array()) {
As title says
I think is preferable to use wp_title()
instead of QueryHelper::get_page_title()
to set the page title in the vanilla theme, as this would maintain compatibility with wp_title
WordPress filter.
As title says.
I couldn't get the locales to work at first. But after a while I managed to find a solution, which could've been solved with a simple note in the documentation.
Using __() without the domain specified will not work, i.e.:
__("News")
Using the domain we will make it work, i.e:
__("News", "we")
Maybe this should be mentioned in README.mdown?
Actually the documentation can only be build from the git repository. Could be a good idea to make it disposable online and downloadable from the git page ? :D
Can you add an option to the wordless config file that would allow me to see the debug messages in both css and js outputs?
everything is working fine, except that i'm not getting any css output. i'm currently running codekit to output css. please let me know what further info you need.
While setting up Wordless, I encountered these issues:
"/Users/Johan/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs':
Could not find compass (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /Users/Johan/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/Johan/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /Users/Johan/.rvm/gems/ruby-1.9.2-p0/bin/compass:18:in `<main>'
and
/Users/Johan/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- sprockets (LoadError)
from /Users/Johan/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/Johan/Sites/dev/wordpress/wp-content/plugins/wordless/wordless/preprocessors/sprockets_preprocessor.rb:5:in `<main>'
Seems like the scripts can't use sprockets
and compass
, even though I have these gems installed (through RVM). I've configured my Compass and Ruby paths in the Wordless preferences file:
Wordless::set_preference("compass.compass_path", "/Users/Johan/.rvm/gems/ruby-1.9.2-p0/bin/compass");
Wordless::set_preference("sprockets.ruby_path", "/Users/Johan/.rvm/rubies/ruby-1.9.2-p0/bin/ruby");
Do I really have to create a gemset in order to make Wordless compile Sass and CoffeeScript?
The asset_hash method in CompassPreprocessor doesn't currently work because it looks for .coffee files instead of stylesheets.
So I assume this:
$files = $this->folder_tree(dirname($base_path), "*.coffee");
Needs to be changed to:
$files = $this->folder_tree(dirname($base_path), "*.{sass,scss}");
Actually there are some options in new_post_type
and new_taxonomy
that are hardcoded and cannot be overriden in any way.
<?php
register_post_type(
$name["singular"],
array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'has_archive' => true,
'rewrite' => array('slug' => $name["plural"]),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => $supports
)
);
<?php
register_taxonomy(
$name["singular"],
$post_types,
array(
'hierarchical' => $hierarchical,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => $name["plural"])
)
);
We nedd to add an option array that can override this options.
There is a little bug in latest_posts_of_category()
which prevent it from working.
<?php
'tax_query' => array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $category,
),
should be
<?php
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $category,
),
),
I think a Wordless gem would simplify many operations and bring a healthy dose of Rails culture to WordPress development.
Some example tasks I would propose:
wordless new mysite
config/initializers/wordless_preferences.php
wp-content/themes/mysite/theme/tmp/*
)Some other possible stuff:
wordless new mysite -c less
: Preconfigure the theme with the LESS preprocessor, see #58
wordless new mysite -v php
: Use PHP views instead of Haml views in the generated theme
wordless new mysite --edge
: Use master branch of Wordless instead of latest stable
wordless compile
: Compile static assets (see #59)
wordless deploy production
: Compile assets and deploy using Wordmove (or some other mechanism)
Any thoughts?
Instead of:
Your current theme does seem to be a Wordless-compatible theme! Learn more (https://github.com/welaika/wordless#readme)
something along the lines of:
Your current theme does seem to be a Wordless-compatible theme! Create a new WordLess theme ([wordpress_url]/wp-admin/themes.php?page=create_wordless_theme)
so that the user knows what to do next
Could be a good idea to make Wordless automatically add user defined custom post type to the default WordPress feed? For me it seems logical, as the default feed must contains all the content posted on the website...
Maybe we could implement this with a configurable parameter?
As title says.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.