Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've set up my new shiny 3.5.1 WordPress using Git, following these instructions: http://clintberry.com/2011/speed-up-your-wordpress-development-cycle-with-git/

(stopping after step 2; I've not created the child theme yet). I would expect the Roots theme to work by itself)

What I basically have is the same as the author's Git project: https://github.com/clintberry/WordPress

What I've ended up with is tags in the head section like:

<link rel="stylesheet" href="/assets/css/app.css">

I've checked in Chrome using the Web Inspector, and it tries to load

http://antonyh.co.uk/assets/css/app.css 

and returns a 404 file not found.

Why do these files not work?

Is there some magic I need to inject somewhere to make it load the CSS from the themes folder (which has roots/assets/css/app.css)?

I've not activated the theme yet, as I don't want a broken site. I could fix this with rewrite rules but that somehow feels wrong. Any help or clues would be appreciated.

share|improve this question
3  
roots adds rewrite rules to your htaccess file to handle requests for /assets/ in the file /lib/htaccess.php. do you have mod_rewrite and is your htaccess file writable? –  Milo Feb 13 '13 at 22:54
    
Yes everything is writable and I do have mod_rewrite. Should there be a .htaccess in wp-content/themes/roots ? Or does it alter the .htaccess file in the site root? –  antonyh Feb 14 '13 at 8:05

1 Answer 1

up vote 3 down vote accepted

I took a risk and activated the theme to see what might happen. Roots needs to complete theme activation to add the rules into .htaccess. Until this happens none of the CSS / JS will load and the theme preview lacks stylesheets.

It turns the stock .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule .*\.git/.* - [F]
</IfModule>

into something much longer, including

RewriteRule ^assets/css/(.*) /wp-content/themes/roots/assets/css/$1 [QSA,L]
RewriteRule ^assets/js/(.*) /wp-content/themes/roots/assets/js/$1 [QSA,L]
RewriteRule ^assets/img/(.*) /wp-content/themes/roots/assets/img/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]

It also adds the Boilerplate HTML .htaccess rules, and removed my .git rule; I'm going to add it back in for safety despite testing showing that the Git folders are not accessible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.