4

Is it at all possible to have <link href="http://jacobraccuia.com/styles.css">inside your Visualforce page and have it work when clicking the http://cs14.salesforce.com/apex/visualforce_page?

That way i can make tons of CSS changes without having to reupload or repackage files.

It works perfectly when I make the site a public domain but inside Salesforce it doesn't. It seems like I'm going to have to re-zip and reference as a static resource whenever I want to demo or repackage or something. The other problem is that one of the components requires log-in, which is not something I have set up...

I haven't fooled around with the Eclipse IDE, but maybe that is the way to go.

edit: here is the top of my code!

<apex:page sidebar="false" showHeader="false"  standardStyleSheets="false" controller="Boardroom_Home_Jacob">
<head>
    <apex:stylesheet value="http://jacobraccuia.com/bootstrap/css/bootstrap.min.css" />
    <apex:stylesheet value="http://jacobraccuia.com/sf_styles.css" />
</head>

edit 2: adding https:// seemed to work perfectly in Firefox, but in Chrome.... (failed) net::ERR_INSECURE_RESPONSE

  • Don't forget: The URL for your page is cs14.salesforce.com/apex/visualforce_page, and if it's a site, then the website won't be cs14.salesforce.com - it will have some other subdomain. – DavidSchach Apr 10 '14 at 19:26
  • @DavidSchach yes it is! – Jacob Raccuia Apr 10 '14 at 19:27
  • See answer below: Remove head tags. Not intuitive for "real" web developers, but that's a quirk of Visualforce. – DavidSchach Apr 10 '14 at 19:30
4

Yes. You can absolutely do that. But use this markup:

<apex:stylesheet value="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>

I'm sure others will answer with style tips, such as working within a Visualforce Component at first, or using a text static resource, but if this way works for you while developing, then go for it.

Just saw the edit to the code above. Don't put the VF tags in tags. Just put them "naked." Don't use head tags at all here.

<apex:page sidebar="false" showHeader="false"  standardStyleSheets="false" controller="Boardroom_Home_Jacob">
<apex:stylesheet value="http://jacobraccuia.com/bootstrap/css/bootstrap.min.css" />
<apex:stylesheet value="http://jacobraccuia.com/sf_styles.css" />
</apex:page>

That's it. Should do it. Although if you're using https for your site, it may want secure listings for the stylesheets.

  • this didn't work - nothing changed! – Jacob Raccuia Apr 10 '14 at 19:24
  • That's impossible. This is exactly how I - and everyone else - links to stylesheets when they are externally hosted. Can you please post the code to your page so we can see if something else is interfering? – DavidSchach Apr 10 '14 at 19:25
  • I updated the code above – Jacob Raccuia Apr 10 '14 at 19:28
  • Still nothing! I moved them outside / moved the head tags. I noticed that only like one of the external links at all works, and that is an image. I tried removing the HTTP: as well. Note: they work on the external site still. – Jacob Raccuia Apr 10 '14 at 19:33
  • See my edit. Please debug this using a regular Visualforce page, without going through the Site - once it works there, you can put the page into a Site and go from there. – DavidSchach Apr 10 '14 at 19:36
1

If you decide to use the Eclipse Force.com IDE you can download the Zip Editor plug-in and it allows you to edit and save the files (including css & js) in your static resources from inside of eclipse. This makes deployment of CSS and JS way easier and much less time consuming.

Here is the source forge link:

http://sourceforge.net/projects/zipeditor/

  • I read somewhere that it is a little different in a Mac environment. I'm hesitating on it, but will likely bite closer to deployment. – Jacob Raccuia Apr 10 '14 at 20:03
0

If you're just wanting an easy was to deal with zipping, use sublime/mavens mate. They have a thing called "resource bundles" so you can edit files while still zipped, then in one step, deploy it back to the server as a static resource.

Besides being a generally awesome text editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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