Configuration

All configuration is hidden in the package @acanto/laravel-scripts published on npm, your project just uses its package.json file to apply some necessary configurations and run the scripts. In this way a project have fewerdependencies and the scripts can be updated separately from each project, so that every project can benefit from the updates.

package.json#

Some shortcuts are automatically add to your package.json, for instance:

"scripts": {
"start": "npx acanto start",
"build": "npx acanto build",
"test": "npx acanto test"
}

Each project can override some basic configurations of the scripts from the config section of it package.json. The following configuration is required and automatically injected if missing, it can and should be customised accordingly to your specific project:

"config": {
"favicons": {
"background": "#fefefe"
}
}

.env#

This file (and its variants env.example, .env.dev, .env.staging, .env.production) will be autogenerated if not found trying to guess the values.

Some useful variables dependent on the environment are automatically made always available to all js and scss files.

Inside all SCSS files you have for instance:

$DEV: true; // or false
$ENV: "local" | "dev" | "staging" | "production"; // as defined in the `APP_ENV` of the current .env file
$SRC_ASSETS: "../assets";
$URL_ASSETS: "https://myproject.com/themes/acanto/assets";
$SRC_FONTS: "../assets/fonts";
$URL_FONTS: "https://myproject.com/themes/acanto/assets/fonts";
$SRC_IMAGES: "../assets/images";
$URL_IMAGES: "https://myproject.com/themes/acanto/assets/images";
$SRC_SVGICONS: "../assets/svgicons";

Inside all JS files you have for instance:

const __DEV__ = true; // or false
const __ENV__ = "local" | "dev" | "staging" | "production"; // as defined in the `APP_ENV` of the current .env file
const __URL__ = "https://myproject.com";
const __API__ = "https://myproject.com/api";
const __ASSETS__ = "https://myproject.com/themes/acanto/assets";
const __FONTS__ = "https://myproject.com/themes/acanto/assets/fonts";
const __IMAGES__ = "https://myproject.com/themes/acanto/assets/images";

All .js files of your project will get automatically IDE support for these variables (at least in VScode): js-constants-autocomplete