PHPackages                             craftsnippets/static-file-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. craftsnippets/static-file-manager

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

craftsnippets/static-file-manager
=================================

Keep your static files list in PHP configuration file.

3.1.1(1y ago)1300[5 issues](https://github.com/craft-snippets/Craft-static-file-manager/issues)MITPHP

Since Dec 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/craft-snippets/Craft-static-file-manager)[ Packagist](https://packagist.org/packages/craftsnippets/static-file-manager)[ RSS](/packages/craftsnippets-static-file-manager/feed)WikiDiscussions Craft-5 Synced today

READMEChangelog (9)Dependencies (1)Versions (12)Used By (0)

Static file manager
===================

[](#static-file-manager)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require craftsnippets/static-file-manager

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for asset manifest.

Overview
--------

[](#overview)

- This plugin allows you to keep the list of CSS, JS and Favicon files in PHP configuration file instead of Twig templates.
- You can inject files from config file into frontend site and into control panel. CSS and JS files will be injected into proper places - CSS files to end of `` and JS files at end of ``.
- You can also include links to google fonts CSS files, like `https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400&display=swap` - it will be included like other CSS files.
- Plugin also allows for cache busting of files by appending URL parameter to their paths which contains their modification date. This means that files will be cache busted only if they were modified. Files from external servers won't be cache busted.
- Plugin exposes endpoint that lists all static files in JSON format, so the list can be consumed by frontend build tools. This does not include google fonts files.

Usage
-----

[](#usage)

In order to use plugin, place this code into base template of your project. Remember that static files won't be inserted is there is no `` or `` tags in your template.

```
{% do craft.staticFileManager.outputFiles() %}

```

You can pass variable set to `false` to this function to cancel injection of assets into template:

```
{% do craft.staticFileManager.outputFiles(false) %}

```

Files list to inject is set in `config/static-file-manager.php` setting file, under `filesList` setting. To inject files into control panel, place them into `cpFileList` setting. All file paths are relative to the web root. Here is example config file:

```
