Skip to content

Commit

Permalink
Fixes icon fonts, cleans up asset structure
Browse files Browse the repository at this point in the history
Publishes fewer files now. We were publishing more than was necessary.
  • Loading branch information
CorWatts committed Jul 19, 2019
1 parent 01e79ef commit 41f8482
Show file tree
Hide file tree
Showing 22 changed files with 317 additions and 142 deletions.
2 changes: 1 addition & 1 deletion common/config/aliases.php
Expand Up @@ -5,6 +5,6 @@
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('@web', '/');
Yii::setAlias('@webroot', '@site/web');
Yii::setAlias('@assets', dirname(dirname(__DIR__)) . '/site/assets');
Yii::setAlias('@assets', dirname(dirname(__DIR__)) . '/site/assets/publish');
Yii::setAlias('@graphImgPath', '@webroot/charts');
Yii::setAlias('@graphImgUrl', '/charts');
19 changes: 5 additions & 14 deletions environments/dev/site/config/bundles-local.php
@@ -1,19 +1,10 @@
<?php

// uncheck the below to use compressed assets, after running the `./yii asset` command
//return require(dirname($_SERVER['SCRIPT_FILENAME']) . '/../assets/assets-compressed.php');

return [
'yii\bootstrap\BootstrapPluginAsset' => false,
'yii\bootstrap\BootstrapAsset' => false,
'yii\web\JqueryAsset' => [
'sourcePath' => '@assets',
'js' => [
'js/jquery-3.2.1.min.js',
]
yii\bootstrap\BootstrapAsset::class => [
'css' => [], // disable bootstrap css because we pull it directly into our app.scss file
],
];
//return array_merge(
// require(dirname($_SERVER['SCRIPT_FILENAME']) . '/../assets/assets-compressed.php'),
// [
// 'yii\bootstrap\BootstrapPluginAsset' => false,
// 'yii\bootstrap\BootstrapAsset' => false
// ]
//);
19 changes: 0 additions & 19 deletions environments/prod/common/config/bundles-local.php

This file was deleted.

10 changes: 10 additions & 0 deletions environments/prod/site/config/bundles-local.php
@@ -0,0 +1,10 @@
<?php

// uncheck the below to use compressed assets, after running the `./yii asset` command
//return require(dirname($_SERVER['SCRIPT_FILENAME']) . '/../assets/assets-compressed.php');

return [
yii\bootstrap\BootstrapAsset::class => [
'css' => [], // disable bootstrap css because we pull it directly into our app.scss file
],
];
16 changes: 5 additions & 11 deletions site/assets/AppAsset.php
@@ -1,18 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/

namespace site\assets;

use yii\web\AssetBundle;

/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class AppAsset extends AssetBundle
{
public $sourcePath = '@assets';
Expand All @@ -22,9 +13,12 @@ class AppAsset extends AssetBundle
];

public $depends = [
'yii\web\YiiAsset',
'yii\web\JqueryAsset',
'site\assets\BootstrapPluginAsset',
'yii\web\YiiAsset',
// we disable all the css in the bootstrap asset here. But we pull the css into the main appasset css at the top.
// however, the bootstrap fonts are still pulled in here in this bootstrap asset. The url is different, because the css (pulled in via appasset) is looking for the fonts in its same asset directory.
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'site\assets\MomentAsset',
'site\assets\ChartjsAsset',
];
Expand Down
33 changes: 0 additions & 33 deletions site/assets/BootstrapPluginAsset.php

This file was deleted.

11 changes: 0 additions & 11 deletions site/assets/ChartjsAsset.php
@@ -1,20 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/

namespace site\assets;

use yii\web\AssetBundle;

/**
* Asset bundle for the Twitter bootstrap css files.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class ChartjsAsset extends AssetBundle
{
public $sourcePath = '@bower/chartjs/dist';
Expand Down
11 changes: 0 additions & 11 deletions site/assets/MomentAsset.php
@@ -1,20 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/

namespace site\assets;

use yii\web\AssetBundle;

/**
* Asset bundle for the Twitter bootstrap css files.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class MomentAsset extends AssetBundle
{
public $sourcePath = '@vendor/moment/moment/min';
Expand Down
11 changes: 0 additions & 11 deletions site/assets/PickadateAsset.php
@@ -1,20 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/

namespace site\assets;

use yii\web\AssetBundle;

/**
* Asset bundle for the Twitter bootstrap css files.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class PickadateAsset extends AssetBundle
{
public $sourcePath = '@bower/pickadate/lib';
Expand Down
5 changes: 3 additions & 2 deletions site/assets/assets.php
Expand Up @@ -7,7 +7,7 @@
Yii::setAlias('@webroot', __DIR__ . '/../web');
Yii::setAlias('@web', '/');

$mainConf = require(Yii::getAlias('@site/config/main.php'));
$mainConf = require Yii::getAlias('@site/config/main.php');
$converter = $mainConf['components']['assetManager']['converter'];
$bundles = $mainConf['components']['assetManager']['bundles'];

Expand All @@ -21,7 +21,8 @@
'yii\web\JqueryAsset',
'site\assets\AppAsset',
'yii\web\YiiAsset',
'site\assets\BootstrapPluginAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'yii\widgets\ActiveFormAsset',
'yii\validators\ValidationAsset',
'yii\captcha\CaptchaAsset',
Expand Down
4 changes: 0 additions & 4 deletions site/assets/js/jquery-3.2.1.min.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions site/assets/css/app.scss → site/assets/publish/css/app.scss
Expand Up @@ -3,6 +3,8 @@
* $body-bg: lightgray;
*/
$font-size-base: 16px !default;
// we've copied the fonts to a different folder here. The reletive path is different, so we needed to change this variable.
$icon-font-path: "../fonts/" !default;

html,
body {
Expand Down
Binary file not shown.

0 comments on commit 41f8482

Please sign in to comment.