javascript - Yii2 add image,css,js files from vendor folder on page from js script -


i try create lib editing pictures. have main js file including other js, css , images files. example, used:

$.getscript(site_url + '/vendor/first_folder/second_folder/assets/js/script.js'); 

i read path web sets @ appasset.php, if ask change @webroot @vendor.. @ extention configuration think wrong. created myasset.php , set there such configurations:

namespace app\vendor\first_folder\second_folder;  use yii\web\assetbundle;  class edikeditorasset extends assetbundle {      public $sourcepath = '@vendor/first_folder/second_folder/assets/';     public $css = [          'css/main.css'     ];     public $js = [               'js/jquery.colorbox-min.js',               'js/main.js'             ];    } 

but cannot include others js, css , image files extention, because js,css , images start including web folder , don't know how go above. can change including js, css, images files vendor folder?

p.s. tried change using different paths part in js, noone worked, think problem not in this:

$.getscript(site_url + '/vendor/first_folder/second_folder/assets/js/script.js);

vendor folder not web accessible. 1 solution symlink css, js, img vendor folder web folder. include that. or here yii way it:

<?php  namespace app\assets;  use yii\web\assetbundle;  class bootstrapasset extends assetbundle {  //set source path using @vendor or alias @bower here   public $sourcepath = '@bower/bootstrap/dist';  //include css , js relative source path set above   public $css = [     'css/bootstrap.css',   ];   public $js = [     'js/bootstrap.min.js',   ]; } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -