and use the interactive installation command that comes with Concrete's CLI tool
$ concrete c5:install -i
Follow directions and your site will begin installing!
Find the package you'd like to install on packagist.org (in this case concretecms/sample_composer_package
)
Note: You can also use composer's repository functionality to manage private packages using composer
$ composer require concretecms/sample_composer_package
$ concrete c5:package-install sample_composer_package
This library uses Laravel Mix. See webpack.mix.js. To build assets:
npm install
npm run dev # Build for development
npm run hot # Build with hot reloading enabled (See hot reloading section)
npm run watch # Build with a watcher that rebuilds when files change
npm run prod # Build for production
Hot module replacement (hot reloading) allows you to write code and instantly see the changes in your browser, without reloading the page.
To use hot reloading with Concrete, you'll want to use the mix
and mixAsset
helper functions to wrap your
JS and CSS urls. These functions make it so that your assets automatically detect hot reloading mode and output the appropriate urls, they are safe to use in production:
In a page theme:
<?php
use function Concrete5\Composer\mixAsset;
...
class PageTheme extends Theme
{
public function registerAssets()
{
$this->requireAsset(mixAsset('/path/to/file.js'));
}
}
<?php
use function Concrete5\Composer\mixAsset;
...
class Controller extends BlockController
{
public function registerViewAssets()
{
$this->requireAsset(mixAsset('/path/to/js/file.js'));
$this->requireAsset(mixAsset('/path/to/css/file.css'));
}
}
or in a theme template:
<?php
use function Concrete5\Composer\mix;
?>
<script src='<?= mix('/path/to/your/asset.js') ?>'></script>
<link href='<?= mix('/path/to/your/asset.css') ?>' />
Do you want to install an add-on that is free in the Concrete marketplace, but not on packagist.org? Go to https://composer.concretecms.org/.