Yii Framework Forum: Publish And Generate Assets In Console Command - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Publish And Generate Assets In Console Command Rate Topic: -----

#1 User is offline   TheBee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 31-July 12
  • Location:Indonesia

Posted 08 February 2013 - 11:40 AM

Hi All,

I build my site with some less files inside and also with some of another assets, I use h**ps://github.com/zsoltlengyelit/LessCSS-for-Yii for compile less files, and h**ps://github.com/andremetzen/yii-s3assetmanager for deploy to S3.

But the problem is when I refresh the assets and want to generate the new one it takes so long until my server stop because its already reach max execution time for compiling the CSS, and I've got a better idea to generate all this assets and publish it with console so I could run it when I deploy to production. But another problem is comes up, I couldn't run :

Yii::app()->getAssetManager()->publish();


it always said :

CConsoleApplication.clientScript is not defined


Is there any chance/way to publish assets with commands/console? I hope this make sense for you.

Thanks.
0

#2 User is offline   rootbear 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 17-June 11

Posted 08 February 2013 - 01:00 PM

same idea came to my mind using console to pre-publish assets, however, console app is actually different from webapp, i did not figure out how i would actual do it. so this is still a question mark to me.

i have to admit i never use LESS, but i'm not sure if i like the idea to have LESS to CSS at runtime, here is what i found: this

still use CSS as normal, just CSS comes from pre-compiled LESS
I enjoy the Yii.sy coding life here.
0

#3 User is offline   TheBee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 31-July 12
  • Location:Indonesia

Posted 10 February 2013 - 03:06 AM

View Postrootbear, on 08 February 2013 - 01:00 PM, said:

same idea came to my mind using console to pre-publish assets, however, console app is actually different from webapp, i did not figure out how i would actual do it. so this is still a question mark to me.

i have to admit i never use LESS, but i'm not sure if i like the idea to have LESS to CSS at runtime, here is what i found: this

still use CSS as normal, just CSS comes from pre-compiled LESS


Yeap I still trying to make this happen, get CClientScript working with console but it always be dead end... maybe anyone already trying something and got some tweak or something that would make this happen.

But if I still didn't found something to solved this maybe I will take your advice to compile the less before deploy it, but I still think it'll be great if we can publish and generate less with console before we deploy it to production server.
0

#4 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 10 February 2013 - 05:55 AM

I've run across this problem when i wrote my package compressor extension. But you can make it work with some extra configuration in your console.php. See the notes here: https://github.com/m...ine-maintenance
1

#5 User is offline   rootbear 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 17-June 11

Posted 15 February 2013 - 05:45 PM

thx, @mike, bookmarked, will study
I enjoy the Yii.sy coding life here.
0

#6 User is offline   TheBee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 31-July 12
  • Location:Indonesia

Posted 17 February 2013 - 01:03 AM

View PostMike, on 10 February 2013 - 05:55 AM, said:

I've run across this problem when i wrote my package compressor extension. But you can make it work with some extra configuration in your console.php. See the notes here: https://github.com/m...ine-maintenance


Great... Thanks Mike.

I just follow your extra configuration at my console.php especially "assetManager" component and now I can publish my assets from console.

Thanks guys.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users