Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove caching meta tags? #74

Open
bradfrost opened this issue Sep 29, 2017 · 4 comments
Open

Remove caching meta tags? #74

bradfrost opened this issue Sep 29, 2017 · 4 comments
Labels

Comments

@bradfrost
Copy link
Member

This is probably a question for @EvanLovely, but I'm trying to clean up the UI as much as possible. We currently have this code in the head:

<!-- never cache patterns -->
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />

I believe that was to force the browser to never cache patterns so you always so the latest version. That said, I was wondering if there's another way to accomplish that without these tags? Or if it's necessary at all?

@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Sep 29, 2017

Some interesting results from here: https://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers

The accepted answer (pretty old too) is verbatim to the above, but it looks to not be recommended practice.

In a production environment, I would expect developers to set cache control headers on the web server via .htaccess or an equivalent. Right?

EDIT

Answering your question more specifically, I've never seen BrowserSync have a problem reloading CSS or a pattern, but I don't know if messing with these meta tags would alter that behavior (I'd think not). Something you can certainly try while you are poking around there! 🚧

@bradfrost
Copy link
Member Author

Thanks @bmuenzenmeyer!

Fascinating the post is from '09. I wonder how much of it is still relevant, especially considering cross-browser stuff is woven in there. Being that our audience is developers developing locally, it's a safe assumption they're not using IE9 as their primary dev browser.

In a production environment, I would expect developers to set cache control headers on the web server via .htaccess or an equivalent. Right?

Yep, and again I think these tags are more for dev environments where we want to see the latest changes. I think if Browsersync can wrangle that, then we use that instead.

Answering your question more specifically, I've never seen BrowserSync have a problem reloading CSS or a pattern,

That's my experience too!

, but I don't know if messing with these meta tags would alter that behavior (I'd think not). Something you can certainly try while you are poking around there! 🚧

Here's what I'm going to do: I'm going to rip out all the cache-specific meta tags, and if I start seeing issues where things aren't refreshing properly, I'll add them back in one by one, starting with <meta http-equiv="cache-control" content="no-cache" />.

@bradfrost
Copy link
Member Author

The head looks cleaner now :)

<head>
	<title id="title">Pattern Lab</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width" />
	<link rel="stylesheet" href="styleguide/css/pattern-lab.css" media="all" />
</head>

@EvanLovely
Copy link
Member

I think the cacheBuster is all you need!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants