diff --git a/docs/guide/output-client-scripts.md b/docs/guide/output-client-scripts.md index aab404a..ec3b6b0 100644 --- a/docs/guide/output-client-scripts.md +++ b/docs/guide/output-client-scripts.md @@ -40,13 +40,13 @@ will be added AFTER `jquery.js`. Without this dependency specification, the rela `main.js` and `jquery.js` would be undefined. Like for [[yii\web\View::registerCssFile()|registerCssFile()]], it is also highly recommended that you use -[asset bundles](assets.md) to register external JS files rather than using [[yii\web\View::registerJsFile()|registerJsFile()]]. +[asset bundles](structure-assets.md) to register external JS files rather than using [[yii\web\View::registerJsFile()|registerJsFile()]]. ### Registering asset bundles As was mentioned earlier it's preferred to use asset bundles instead of using CSS and JavaScript directly. You can get -details on how to define asset bundles in [asset manager](assets.md) section of the guide. As for using already defined +details on how to define asset bundles in [asset manager](structure-assets.md) section of the guide. As for using already defined asset bundle, it's very straightforward: ```php @@ -90,6 +90,6 @@ The code above will add a link to CSS file to the head section of the page. used instead. -It is highly recommended that you use [asset bundles](assets.md) to register external CSS files rather than +It is highly recommended that you use [asset bundles](structure-assets.md) to register external CSS files rather than using [[yii\web\View::registerCssFile()|registerCssFile()]]. Using asset bundles allows you to combine and compress multiple CSS files, which is desirable for high traffic websites. diff --git a/docs/guide/structure-assets.md b/docs/guide/structure-assets.md index 483147a..0e41b1a 100644 --- a/docs/guide/structure-assets.md +++ b/docs/guide/structure-assets.md @@ -165,6 +165,16 @@ and corresponding values to set. Setting `sourcePath` to `null` tells asset manager not to copy anything while `js` overrides local files with a link to CDN. +> Tip: You may also use this procedure to configure different scripts dependent on the environment. For example +> use minified files in production and normal files in development: +> +> ```php +'yii\web\JqueryAsset' => [ + 'js' => [ + YII_ENV_DEV ? 'jquery.js' : 'jquery.min.js' + ] +], +``` Enabling symlinks -----------------