Giter Club home page Giter Club logo

Comments (28)

scalisi avatar scalisi commented on May 10, 2024

Sass files (and CoffeeScript files) aren't compiled automatically by Wordless for me, either. I'm using rbenv on Debian. I followed the instructions on the wiki page titled "Making Wordless work with rbenv".

I eventually decided to make edits to the Wordless plugin's files to try to narrow down the cause of the issue. The best I could do was to determine that the call to array_key_exists($preprocessor->query_var_name(), $wp->query_vars) in the parse_request() function in wordless/wordless/wordless.php returns false for each preprocessor, so serve_compiled_file($to_process_file_path, Wordless::theme_temp_path()) is never called.

For now I'm using compass watch to compile Sass files.

from wordless.

emzo avatar emzo commented on May 10, 2024

tl;dr - make sure requests for CSS and JS files are reaching your FastCGI process

I had this issue when I first installed Wordless. Turns out I had set up my web server (nginx in my case) to serve images, stylesheets and javascripts statically, bypassing PHP/Wordless altogether. My nginx conf is based on the example given on the WordPress Codex. The offending part is:

# Directives to send expires headers and turn off 404 error logging.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires 24h;
    log_not_found off;
}

I changed it to this, to make sure requests for files ending in .css and .js are handled by PHP/Wordless

# Send js and css requests to Wordless
location ~* \.(js|css)$ {
    try_files $uri /index.php?$args;
}

# Directives to send expires headers and turn off 404 error logging.
location ~* \.(png|jpg|jpeg|gif|ico)$ {
    expires 24h;
    log_not_found off;
}

from wordless.

emzo avatar emzo commented on May 10, 2024

This kind of information should probably go in the Wiki

from wordless.

stelam avatar stelam commented on May 10, 2024

I'm also having a similar issues.

I followed the instructions in the Readme file, one stepa at the time. I previously had RVM installed on my machine, so I just ran this in my command line:

rvm use 1.8.7@wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 1.8.7@wordless wordless compass ruby

then I modified my wordless_preferences.php file so it looks like this:

<?php

/*
 * Configure Wordless preferences here.
 */

Wordless::set_preference("assets.preprocessors", array("SprocketsPreprocessor", "CompassPreprocessor"));
// Wordless::set_preference("assets.cache_enabled", true);

Wordless::set_preference("css.compass_path",     "/home/stelam/.rvm/bin/wordless_compass");
// Wordless::set_preference("css.output_style",     "compressed");
// Wordless::set_preference("css.require_libs",     array());

// Wordless::set_preference("css.lessc_path",       "/usr/bin/lessc");
// Wordless::set_preference("css.compress",         false);

Wordless::set_preference("js.ruby_path",         "/home/stelam/.rvm/bin/wordless_ruby");
// Wordless::set_preference("js.yui_compress",      false);
// Wordless::set_preference("js.yui_munge",         false);

Everything seems to work, except that the assets aren't being compiled. The stylesheet_link_tag() function generates a link to:

/wp-content/themes/MY_WORDLESS_THEME/assets/stylesheets/screen.css

but that file doesn't exist since it hasn't been compiled.

Is there something I have forgotten?

from wordless.

emzo avatar emzo commented on May 10, 2024

Are you sure your web server is passing the request for the CSS file
through to wordless? I remember when I tried to get wordless working
initially, I had configured my web server (nginx) to serve images and CSS
statically, and the request wasn't reaching wordless at all.
On May 25, 2012 9:19 PM, "stelam" <
[email protected]>
wrote:

I'm also having a similar issues.

I followed the instructions in the Readme file, one stepa at the time. I
previously had RVM installed on my machine, so I just ran this in my
command line:

rvm use 1.8.7@wordless --create --default && gem install therubyracer
sprockets compass coffee-script thor yui-compressor && rvm wrapper
1.8.7@wordless wordless compass ruby

then I modified my wordless_preferences.php file so it looks like this:

<?php

/*
 * Configure Wordless preferences here.
 */

Wordless::set_preference("assets.preprocessors",
array("SprocketsPreprocessor", "CompassPreprocessor"));
// Wordless::set_preference("assets.cache_enabled", true);

Wordless::set_preference("css.compass_path",
"/home/stelam/.rvm/bin/wordless_compass");
// Wordless::set_preference("css.output_style",     "compressed");
// Wordless::set_preference("css.require_libs",     array());

// Wordless::set_preference("css.lessc_path",       "/usr/bin/lessc");
// Wordless::set_preference("css.compress",         false);

Wordless::set_preference("js.ruby_path",
"/home/stelam/.rvm/bin/wordless_ruby");
// Wordless::set_preference("js.yui_compress",      false);
// Wordless::set_preference("js.yui_munge",         false);

Everything seems to work, except that the assets aren't being compiled.
The stylesheet_link_tag() function generates a link to:

/wp-content/themes/MY_WORDLESS_THEME/assets/stylesheets/screen.css
but that file doesn't exist since it hasn't been compiled.

Is there something I have forgotten?


Reply to this email directly or view it on GitHub:
#66 (comment)

from wordless.

itayadler avatar itayadler commented on May 10, 2024

Hey guys I had the same issue as stelam and I solved it by configuring the permalinks (Settings -> Permalinks).
It couldn't write the .htaccess file before so that's why I didn't have one in my root wordpress folder. (Added the correct one manually)

from wordless.

stelam avatar stelam commented on May 10, 2024

Thanks for the replies, my assets are compiling now. Although, I don't know what was wrong.

My web server (apache) was properly configured prior to these problems, and I had already activated WordPress' permalinks using a valid .htaccess

I had these problems on Friday, and then I left for the weekend. When I came back to work this morning, I opened my computer, launched the website and the assets were compiling properly. I guess a simple reboot corrected the issues, but I'm not sure why... As I remember that I tried to restart apache and other services several times last week, and it didn't do much.

Thanks!

from wordless.

endorama avatar endorama commented on May 10, 2024

As @emzo suggested, I created a wiki page to explain the Nginx configuration.

@rvr, @josh2 do you have still problems in compiling assets?

If not I'm gonna close this issue.

from wordless.

rvr avatar rvr commented on May 10, 2024

i haven't had time to try it out for a while, so i'm not sure where it stands. thanks for checking in.

from wordless.

endorama avatar endorama commented on May 10, 2024

Ok, so I'm not goint to close this issue... If you have any problem report them here :)

from wordless.

felixyz avatar felixyz commented on May 10, 2024

My system: Apache, OSX, rbenv. Requests are getting through and hit the compass_preprocessor.php script. The compass invokation is correct, I've tried running it manually with the config file that's generated in process_file. But when compass is run from wordless, I get this error: env: bash: No such file or directory

Apparently bash is not in the path. Any suggestions?

EDIT: I solved this by adding my whole path in wordless_preferences.php. (Where would be a better place?)
putenv("PATH=" . getenv("PATH") . ":/usr/bin:/bin:/usr/sbin:/sbin...etcetc...");

Of course, I'd like to know why I seem to be the only one who has this problem :) How is my PATH supposed to be available inside the theme? (I'm a PHP/WP noob, if you didn't notice.)

from wordless.

endorama avatar endorama commented on May 10, 2024

Actually other users reported problems when using rbenv... I think that this is not a issue strictly related to wordless, but is some ways rbenv handles environments differently from rvm, and this leeds to path problems. I'm not able to understand if the problem is related to the way in which wordless calls compass/ruby executable or if the problem is in the executable themselves...

Have you looked at the wiki page for rbenv configuration? https://github.com/welaika/wordless/wiki/Making-Wordless-work-with-rbenv

I don't use rbenv so I'm not able to help you more than this...

from wordless.

felixyz avatar felixyz commented on May 10, 2024

Yes should have mentioned that I've followed the instructions on the wiki, that's how I got as far as at least trying to call compass. The problem is that when process_file is called, all that's in the path is /Users/Felix/.rbenv/bin. As long as you're starting one process using sh, that's ok, but apparently rbenv wants a bash shell, and that fails because bash is not in the path.

So yes, in a way this is a problem with rbenv. On the other hand, it seems to me that the path should be populated at this point? But then again, I don't know what the environment is usually like within a WP request.

from wordless.

Arkham avatar Arkham commented on May 10, 2024

Maybe @stefanoverna can help us here? He's using rbenv aswell.

from wordless.

felixyz avatar felixyz commented on May 10, 2024

Update: using the latest Wordless (358147d... Jun 27), I no longer need to use the rb_env hacks on the wiki. I simply have this in my wordless_preferences.php:

Wordless::set_preference("css.compass_path", "/Users/Felix/.rbenv/shims/compass");
Wordless::set_preference("js.ruby_path", "/Users/Felix/.rbenv/shims/ruby");

Works fine, however, I still need this ugly line (at the top of wordless_preferences.php):

putenv("PATH=" . getenv("PATH") . ":/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:");

So this no longer looks like a rbenv problem.

from wordless.

rvr avatar rvr commented on May 10, 2024

I'm using the Wordless gem now, but my assets are still not compiling dynamically. Everything is working fine, but I have to run 'worldless compile' every time I make a change. I'm using OS X, Apache, RVM (Ruby 1.8.7).

from wordless.

glebmachine avatar glebmachine commented on May 10, 2024

HI guys! I have the same problem, does anybody have solved this since last updates?

from wordless.

rvr avatar rvr commented on May 10, 2024

I'm still looking for some suggestions. Would love to hear something on this.

from wordless.

felixyz avatar felixyz commented on May 10, 2024

@rvr, @glebmachine If you clean out your /assets subdirectories, I think this problem will go away. Wordless will not hit sprockets or compass (the pre-processor pipeline) if it finds a static (pre-compiled) file in /assets/javascripts or /assets/stylesheets. So throw away any files in those directories, and you should get automatic compilation working again.

Then when you're ready to deploy to your server again, you run "wordless compile" before copying the site over to the remote host. The only gotcha here is that you then have to manually remove the compiled assets again before resuming local development. (I think this should be fixed in Wordless. There should be a development environment flag that makes Wordless disregard any precompiled files and run the assets pipeline on every request.)

By the way, I'm getting the impression that some people are trying to get assets compilation working on their production server. This isn't completely wrong, but it's not the way Worldess is supposed to be used, because that would impose a lot of requirements on the server box (Ruby + gems + JS runtime).

from wordless.

rvr avatar rvr commented on May 10, 2024

@felixyz thanks for the suggestion, but no luck. I cleared out the files but get an error message:

Damn, we're having problems compiling the Sass. Check the CSS source code for more infos.

I don't see that it's outputting any details anywhere.

from wordless.

felixyz avatar felixyz commented on May 10, 2024

@rvr This means Wordless actually did invoke Sass, which seems to be what you wanted. However, there is probably an error in your sass/scss. Did you check the CSS file? It's going to be in the /tmp directory, but you can also find it directly from the developer console in your web browser.

from wordless.

rvr avatar rvr commented on May 10, 2024

@felixyz No, it's not even outputting a CSS file. All I have in /tmp are the template files and the sprockets preprocessor file.

from wordless.

felixyz avatar felixyz commented on May 10, 2024

@rvr, Sorry, it will in fact not be available in the /tmp directory. Instead, use the web inspector in your browser to look at the screen.css which Wordless serves to show you what went wrong. (Gotta admit I'm not sure how this works behind the scenes.)

from wordless.

rvr avatar rvr commented on May 10, 2024

Thanks, that's what I needed to know. Looks like something funky with Bundler. I see some references to others have the same issue ([gem] is not checked out. Please run bundle install (Bundler::GitError)), though none with Wordless. I'm poking around to see if there's a Bundler-related fix. If not, I'll just reinstall gems without using Bundler, I guess.

Here's the error output:

/************************
WordlessCompileException: [0]: Failed to run the following command: '/Users/river/.rvm/bin/wordless_compass' 'compile' '/Users/river/Sites/joshgold/wp-content/themes/jg2012/tmp' '--config' '/Users/river/Sites/joshgold/wp-content/themes/jg2012/tmp/compass_configcOLGO5'
Generated config:
http_path = "./"
http_images_dir = "../images"
images_dir = "../assets/images"
http_fonts_dir = "../fonts"
fonts_dir = "../assets/fonts"
css_path = "/Users/river/Sites/joshgold/wp-content/themes/jg2012/tmp"
relative_assets = false
output_style = :compressed
environment = :production
sass_path = "/Users/river/Sites/joshgold/wp-content/themes/jg2012/theme/assets/stylesheets"

Output error:

/Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/source.rb:801:in `load_spec_files': https://github.com/etienne/wordless_gem.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/source.rb:381:in `local_specs'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/source.rb:774:in `specs'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/lazy_specification.rb:53:in `__materialize__'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/spec_set.rb:86:in `materialize'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/spec_set.rb:83:in `map!'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/spec_set.rb:83:in `materialize'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/definition.rb:113:in `specs'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/gems/bundler-1.2.0/lib/bundler/environment.rb:27:in `specs'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:60:in `setup'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:75
from /Users/river/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in `gem_original_require'
from /Users/river/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in `require'
from /Users/river/.rvm/gems/ruby-1.8.7-p370@wordless/bin/ruby_noexec_wrapper:9
************************/

from wordless.

felixyz avatar felixyz commented on May 10, 2024

@rvr Yeah, I don't know about that. I find it much easier to work with rbenv.

from wordless.

rvr avatar rvr commented on May 10, 2024

@felixyz I haven't messed with rbenv yet, and we're all RVM based where I work. I tried removing Bundler, but haven't had any luck yet. Hopefully someone else will have some ideas.

from wordless.

STRML avatar STRML commented on May 10, 2024

Just an anecdote:

I had a recent issue where the Events Manager plugin somehow interfered with the Permalinks configuration after I changed some settings. This caused Wordless to stop compiling SASS & CoffeeScript. Going to Settings -> Permalinks and simply hitting "Save Settings" fixed the issue.

from wordless.

Arkham avatar Arkham commented on May 10, 2024

Ok, thanks, I'll just close this for now.

from wordless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.