# Discourse-common asset availability: difference between development and production?

**URL:** <https://meta.discourse.org/t/discourse-common-asset-availability-difference-between-development-and-production/107490>\
**Category:** Development\
**Created:** [January 25, 2019, 2:37am UTC](https://meta.discourse.org/t/discourse-common-asset-availability-difference-between-development-and-production/107490 "2019-01-25T02:37:42Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [January 29, 2019, 12:27am UTC](https://meta.discourse.org/t/discourse-common-asset-availability-difference-between-development-and-production/107490/5 "2019-01-29T00:27:38Z")

</div>

The basic implementation of this in the custom wizard will be

```plaintext
Discourse.unofficial_plugins.each do |plugin|
  plugin_name = plugin.metadata.name
  if require_plugin_assets = CustomWizard::Field.require_assets[plugin_name]
    plugin.each_globbed_asset do |f, is_dir|
      if f.include? "raw.hbs"
        name = File.basename(f, ".raw.hbs")
        compiled = Barber::Precompiler.new().compile(File.read(f))
        result << "
          (function() {
            if ('Wizard' in window) {
              Wizard.RAW_TEMPLATES['#{name}'] = requirejs('discourse-common/lib/raw-handlebars').template(#{compiled});
            }
          })();
        "
      end
    end
  end
end

```

Which just requires a plugin to include ‘templates’ in the assets they add to the wizard asset pipeline, e.g.

```plaintext
CustomWizard::Field.add_assets('location', 'discourse-locations', ['components', 'helpers', 'lib', 'stylesheets', 'templates'])

```

The upshot being, I can access the pre-compiled a raw template in a common component by just switching the global namespace:

```plaintext
const global = this.get('global');
let template = global.RAW_TEMPLATES['javascripts/location-autocomplete'];

```

---

_[View the full topic](https://meta.discourse.org/t/discourse-common-asset-availability-difference-between-development-and-production/107490)._
