Ran build & lost CSS

I just heard about Middleman this week and went right to trying it out. I built out a page and ran bundle exec middleman build and my css isn’t connecting with the index.html, it seems. In the head it shows the link tag correctly and at a glance the CSS looks good…

The only thing that may be of more help for anyone to help me is a message I got before the build created all the new files:

The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Slim::EmbeddedEngine is deprecated, it is called Slim::Embedded in Slim 2.0
Slim::EmbeddedEngine is deprecated, it is called Slim::Embedded in Slim 2.0

I got the rubygems message throughout my entire time using Middleman, and there didn’t seem to be any problem. Can anyone help me work this out?

Thanks.

If you take the url of the css from the head and try curl url-of-the-css in terminal (if you are on a mac, don’t know the name of the terminal app on a pc), does that return the css code?

(You may have to add the http://domain part of the url in front of the url of the css.)

P.S: If you’re building locally on you own machine, and just open the index.html with File open… in the web browser, it will not find the css. You need to access the index.html through a web server.

Here’s what I got with curl: http://cl.ly/PAqj
Since I’m working on my machine, there is no http:// address for the css.

What exactly does curl do? I read a bit on it.

I was trying to view index.html in my browser, yes, but even when I put it on my web host, the css wasn’t applied. I cd’d into the build folder and restarted middleman server and it did work.

What do you think?

curl does the same thing as a web browser – it fetches the code. Since web browsers tend to hide things, like http:, for a better user experience, it’s often easier to spot errors in the raw result that curl returns.

In your case, you must feed curl with a proper url. I.e. something like this

curl http://www.yourdomain.com/url-of-the-css-as-you-find-it-in-the-source-of-index.html

From your description, something went wrong when you put/fetched it on your web host. Did you use a http: or a file: to open the index.html? (The later will give the problem you described.)

Maybe I was just being a bozo. Through my machine, when I put the full path to the css it worked, but only when I started it with User/TylerSloan/… that seemed weird.

On my web host, I put the url for the css and it also worked, of course. I’m not sure why that happened, doesn’t seem right, but I made do for the time being. Thanks for your quick responses, Tommy.

If you want to run build by simply double-clicking on the resulting files, you need “relative_assets” since the default build expects a webserver to be serving the built files.

activate :relative_assets