CSS and JavaScript

A TubePress theme can include any number of CSS stylesheets and JavaScript scripts
This article is part of a series on TubePress themes.

In its manifest, a TubePress theme can include any number of CSS stylesheets and JavaScript scripts. TubePress will ensure that the active theme's resources are loaded correctly into the final web page. This provides you with an upgrade-proof means of tweaking the overall look and feel of your TubePress galleries.

Unlike templates, there are no conventions on where you store your CSS and JavaScript files; they only need to be somewhere inside a theme's directory.

Adding a New CSS or JavaScript File

Here's the procedure to add a CSS stylesheet or JavaScript script to your theme:

  1. Save the new CSS or JavaScript file to any location within your theme directory.
  2. Edit your theme's manifest to include the relative, from the theme's root directory, path to the new file. You should add this to the manifest resources property.

    For instance, if you have saved a single CSS file for your theme at tubepress-content/themes/mytheme/css/style.css, then your manifest's resources property might look something like this:

        "resources" : {
            "styles" : [ "css/style.css" ]
  3. Rebuild the system cache so that TubePress detects your theme's new files.


    Any time you add or remove a CSS or JavaScript file from a theme, you will need to rebuild the system cache. However, simply editing these files does not require a cache rebuild.

Important Caveat

Due to the way that PHP works, only the theme selected in persistent storage can have its CSS & JavaScript loaded on your website.

Which theme is "selected in persistent storage"? For WordPress users, it's the theme that you have selected at WP Admin > Settings > TubePress > Theme. For standalone PHP users, it's the theme value you have set in database.json.

You can use multiple invocations of TubePress on a single page, each using a different theme value (either set by shortcode or via an option passed to TubePressPro::getHTML()). However only the templates from those themes can be used - not the CSS & JavaScript.

Last Updated Feb 23, 2016 12:48PM PST
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found