Skip to main content
10 votes
Accepted

What is the optimal place to store CSS files?

In most cases, the best place to store CSS is in a publicly accessible directly, not managed by Craft at all. Such as: public/assets/css/master.css Storing your CSS and other front-end assets ...
Ben Parizek's user avatar
  • 13.5k
7 votes
Accepted

Force browser to download latest CSS file

There are several plugins that can do this. With my plugin Stamp, you can add a timestamp to the filename or path in the following formats: <script src="/assets/build/js/1399647655/scripts.js"&...
André Elvan's user avatar
  • 7,288
7 votes

Best way to handle redesign of large site

Set up a local development environment, and invest in a workflow as described here: Database & Asset Syncing Between Environments in Craft CMS
andrew.welch's user avatar
  • 11.6k
6 votes

Best way to handle redesign of large site

As a more detailed answer than in my comments. You should never make such huge changes in a running live system without deactivating it. No matter how experienced you are with twig, craft, php... you ...
Robin Schambach's user avatar
6 votes

Force browser to download latest CSS file

I tend to use a config.php variable (called assetVersion) for the production site, and just generate a random value for the dev site using Twig's random function. Looks like this: <link rel="...
Ian Ebden's user avatar
  • 894
6 votes
Accepted

renderTemplate() renders the twig file without any CSS

I sincerely appreciate the responses! I've since resolved this issue, below is the changed code. My controller was extending the Craft web controller (\craft\web\Controller) which has its own ...
Josh Kautz's user avatar
4 votes
Accepted

Ugly Redactor II and how to fix it with some CSS

Here is my eye-friendly code: /* Redactor|Fonts */ [class^="redactor-"], [id^="redactor-"] { font-family: inherit !important; } /* Redactor|Toolbar */ ul.redactor-toolbar a { padding: 12px ...
Christian Steger's user avatar
3 votes

Load a specific file/CSS only in a certain page

You can check a specific URL segment. For example if you need to load some CSS on the About page and that URL is yoursite.com/about you can do this: {% if craft.app.request.segments|first == 'about' %...
Simon Kuran's user avatar
  • 3,015
3 votes

Load a specific file/CSS only in a certain page

You can register your file with Twig at the place you need it {% do craft.app.getView().registerCssFile(alias('@assetUrl') ~ '/path/to/css') %}
Robin Schambach's user avatar
3 votes
Accepted

Possible to Get grunt-uncss Working with Craft?

So to close the loop on this one, I actually ended up using a different grunt tool that essentially accomplishes the same goal called purifycss. I was able to target purifycss at the craft template ...
dpayne's user avatar
  • 659
3 votes
Accepted

Newbie: Trying to understand includeCssFile

Whenever Craft receives an URL request, it tries to figure out what resource to serve the client. Among other things, it'll look inside your templates folder and try to find the requested resource ...
Mats Mikkel Rummelhoff's user avatar
3 votes
Accepted

Admin CSS missing from hosted site

A single line in my gitignore file, CSS was preventing the Admin CSS from deploying to the live server. While this problem isn't specific to Craft, I'm leaving it here in case others encounter the ...
Sean O'Brien's user avatar
3 votes

CSS doesn't load on the live server

I'm guessing that the path is not accurate. If you're 100% sure that the path is correct, then check your file permissions. Small chance the permissions are locked down too tight.
Lindsey D's user avatar
  • 24k
3 votes
Accepted

background-image CSS property: how to do it right with Craft?

There is a function called alias that returns a defined alias. A default alias is @web and it represents your base url, background-image: {{ alias('@web') }}/path/to/image.jpg; Would display the ...
Robin Schambach's user avatar
3 votes
Accepted

Use Craft globals for CSS styles

It’s possible to do this by making the entire CSS file a Twig template. Create a new file in your templates folder, such as templates/css/styles.css, with all the dynamic styles you want. To prevent ...
Brandon Kelly's user avatar
3 votes
Accepted

Redactor: Set a min height and preserve line breaks

The redactor configs are stored inside the config/redactor directory. Make sure you're editing the right config that your field uses (eg Standard) and add: "minHeight":"500px", ....
RitterKnight's user avatar
  • 6,582
3 votes

CSS file not being read by other templates

Why use includeCssFile at all for your core CSS? Typically you'd use that for injecting template-specific CSS files (e.g. carousel scripts) that you don't want to load on every page. (The advantage is ...
James Smith's user avatar
  • 5,344
2 votes

Plugin development - Adding Foundation 5 CSS changes Craft CMS control panel

I don't use Foundation 5. I've been using Foundation 6, but I'll offer a suggestion based on Foundation 6 usage. It looks like your Foundation CSS is overriding the base Craft control panel CSS, ...
John Morton's user avatar
2 votes

Admin pages request a broken version of the craft.css file

The fix in this particular case was to modify and save /craft/app/resources/css/craft.css — this revs the timestamp in the query string.
Andy's user avatar
  • 31
2 votes

What is the optimal place to store CSS files?

I had a similar issue...my Craft3 blog pagination was losing the link to my main.css file after the first page, so all content would show but styling disappeared after the main blog index page. As ...
matt.bryant's user avatar
2 votes

Plugin settings page in CP styling

Plugin UXD is intended to help you "design" one or more control panel pages in Craft. It is not a complete style guide but provides a set of typography, field and table elements that enables you to ...
Ben Croker's user avatar
  • 7,536
2 votes
Accepted

Modify how the html fields are outputted by Redactor

To add inline styles to HTML tags generated by Redactor such as <li>, install the Retcon plugin and add the following to your template. For example: {{ entry.body | retconAttr('li', { style: '...
Andrea DeMers's user avatar
2 votes
Accepted

Homepage showing up as "index of \" page

I found the problem, I guess it wasn't craft cms related. I had to update my apache2 site-enabled config file!
Tony Garand's user avatar
2 votes

Best way to handle redesign of large site

To migrate an existing site you'll want to create a second environment to work in: www.yourwebsite.com (your live site) new.yourwebsite.com (your new website) Some of the other answers discuss ...
Ben Parizek's user avatar
  • 13.5k
2 votes
Accepted

CSS will not load Craft 3 + MAMP

After some searching, I decided to move my src/ folder into the web/ folder, since Craft seems to be looking only there and not at anything above that directory. Then, my CSS links were updated to ...
Chris Treadwell's user avatar
2 votes

renderTemplate() renders the twig file without any CSS

To me it looks like something with your sites URL is wrong or your server's configuration and therefore the CSS is not loaded. Can you take a look into your HTML-Output regarding the Links to the ...
Luke's user avatar
  • 531
2 votes

How to make field instructions show as tooltip?

Install control panel CSS plugin, and add the following style. .field .heading{ position: relative; } .field.tooltip-icon-append label:after{ content: "i"; font-style: italic; ...
Parry Huang's user avatar
1 vote

Navbar in Craft CMS

There is nothing that I can see in your CSS that hides the dropdown in the first place. Also I hope you don't mind me saying but your CSS seems over-complicated. To hide / show the drop down you could ...
Seth Warburton's user avatar
1 vote

Homepage showing up as "index of \" page

Ok here is a quick solution to your problem: Move all your public files to the same directory where your craft folder is. Change your Craft path in index.php file.
hashtagerrors's user avatar
1 vote

Modify how the html fields are outputted by Redactor

Craft uses the redactor js plugin. You can change it's settings, plugins and all formats like you want in the config craft/config/redactor or add custom presets. Here is the link how to configure the ...
Robin Schambach's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible