LogoLogo
SourceSupportTraining
v3.x
v3.x
  • Introduction
  • Intro
    • Introduction
      • What's New With 3.7.0
      • What's New With 3.6.0
      • What's New With 3.5.0
      • What's New With 3.1.0
      • What's New With 3.0.0
        • Architecture
        • Administrator
        • Themes
        • Front End
        • Upgrading to 3.0.0
      • About This Book
      • Author
  • Getting Started
    • Installation
      • System Requirements
      • CommandBox Installation
      • Source Installation
      • WAR Installation
      • Express Installation
      • Existing ColdBox Application
      • Upgrading ContentBox
      • Docker
    • Quick Guide
  • Usage
    • Using ContentBox
      • Content
        • Publish Content
          • Blog
          • Sitemap
          • Content Editing Tips
            • Editor Features
            • Dynamic Variable Output
            • Markdown Support
            • Scheduled Content
        • Consume Content
          • Content Store
          • Categories
          • Media Manager
          • Menu Manager
      • Comments
        • Inbox
        • Settings
      • Look & Feel
        • Active Theme
        • Global HTML
        • Themes
        • Widgets
          • Inserting a Simple Widget
      • Modules
        • Installing Modules
        • Managing Modules
      • Users
        • Manage
        • Permissions
        • Roles
      • Tools
        • Import
        • Export
        • Static Site Generation
      • System
        • Auth Logs
        • Geek Settings
        • Settings
          • Site Options
          • Admin Options
          • Security Options
          • Login Options
          • Content Options
          • Editor Options
          • Media Manager Options
          • Gravatars
          • Notifications
          • Mail Server
          • Search Options
          • Login Options
        • Security Rules
        • Updates
  • Developing
    • Developing For ContentBox
      • Front-End Development
        • File Structure
        • Theme Development
          • Theme Settings
          • Theme UDFs
          • Theme Templates
          • Theme Layouts
          • Theme Views
          • Theme SEO Functionality
        • The Content Store
        • Customizing Views
        • Customizing Layouts
        • Managing Assets
        • Customizing Navigation
        • Global Variables
        • Template Variables
      • Back-End Development
        • Overriding ContentBox Settings
        • Modules
          • Installing a Module
          • Using a Module
          • Module Locations and Conventions
          • Build a Module
          • Scaffold a Module
          • Theme your Module
          • Build an Admin Module
          • Adding Admin Menus to your Module
          • Adding Meta to your Modules
        • Widgets
          • Simple Widget
          • Widgets with Arguments
          • Multiple Render Function Widgets
        • JS and CSS Assets
        • Interceptors
        • Accessing Logged in User
        • Customizing the Admin
        • Staying on the Upgrade Path
Powered by GitBook
On this page
  • Working with Assets in the Admin
  • Javascript Assets
  • CSS Assets

Was this helpful?

Edit on Git
Export as PDF
  1. Developing
  2. Developing For ContentBox
  3. Back-End Development

JS and CSS Assets

Working with Assets in the Admin

To make Asset management easier in the Admin, we have provided a few arrays, that you can append your assets to. We have JS and CSS arrays, as well as convention based, and full path arrays.

Javascript Assets

We have two options for working with Javascript in the admin.

jsAppendList

This expects the name of the js file ( without the .js extension ) which is located in the ContentBox includes/js folder. This is a simple convention based approach, so you can easily just append a file, for example arrayAppend( jsAppendList, 'dragula' ) to load /includes/js/dragula.js

jsFullAppendList

This expects the full path of the js file ( including the .js extension ), including the location. This is useful, because you may be using grunt or gulp to compile files, store them in different locations, or actually link out to a CDN for some of your scripts.

For example:

  • arrayAppend( jsFullAppendList, '/includes/js/dragula.js' );

  • arrayAppend( jsFullAppendList, 'https://code.jquery.com/jquery-3.1.1.min.js' );

How the JS is output

Inside of /modules/contentbox-admin/layouts/inc/HTMLBodyEnd.cfm you will see the following code.

<cfloop list="#event.getValue( "jsAppendList", "", true )#" index="js">
    <script src="#prc.cbroot#/includes/js/#js#.js"></script>
</cfloop>
<cfloop list="#event.getValue( "jsFullAppendList", "", true )#" index="js">
    <script src="#js#"></script>
</cfloop>

CSS Assets

We have two options for working with CSS in the admin.

cssAppendList

This expects the name of the CSS file ( without the .css extension ) which is located in the ContentBox includes/css folder. This is a simple convention based approach, so you can easily just append a file, for example arrayAppend( cssAppendList, 'dragula' ) to load /includes/css/dragula.css

cssFullAppendList

This expects the full path of the css file ( including the .css extension ), including the location. This is useful, because you may be using grunt or gulp to compile files, store them in different locations, or actually link out to a CDN for some of your scripts.

For example:

  • arrayAppend( cssFullAppendList, '/includes/css/dragula.css' );

  • arrayAppend( cssFullAppendList, 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );

How the CSS is output

Inside of /modules/contentbox-admin/layouts/inc/HTMLHead.cfm you will see the following code.

<cfloop list="#event.getValue( "cssAppendList", "", true )#" index="css">
    <cfset addAsset( "#prc.cbroot#/includes/css/#css#.css" )>
</cfloop>
<cfloop list="#event.getValue( "cssFullAppendList", "", true )#" index="css">
    <cfset addAsset( "#css#" )>
</cfloop>

Last updated 7 years ago

Was this helpful?