×ðÁú¿­Ê±¹ÙÍøµÇ¼

Laravel¿ª·¢£ºÔõÑùʹÓÃLaravel Mix±àÒëÇ°¶Ë×ÊÔ´£¿

ÔÚÏÖÔÚµÄweb¿ª·¢ÖУ¬Ç°¶Ë×ÊÔ´±àÒëÒѾ­³ÉΪÁ˱ØÐèµÄÒ»²½¡£¶ølaravel×÷Ϊһ¸öÖøÃûµÄphp¿ò¼Ü£¬ÎªÁËÀû±ã¿ª·¢Õ߶ÔÇ°¶Ë×ÊÔ´¾ÙÐбàÒëºÍÖÎÀí£¬Ò²ÌṩÁËlaravel mixÕâÒ»¹¤¾ß¡£±¾ÎĽ«´ÓÒÔÏÂÈý¸ö·½ÃæÏÈÈÝÔõÑùʹÓÃlaravel mix±àÒëÇ°¶Ë×ÊÔ´¡£

Ò»¡¢×°ÖÃLaravel Mix

ҪʹÓÃLaravel Mix£¬Ê×ÏÈÐèÒªÔÚÏîÄ¿ÖÐ×°ÖÃÆäÏà¹ØÒÀÀµ¡£¿ÉÒÔͨ¹ýnpm¾ÙÐÐ×°Öã¬ÊäÈëÒÔÏÂÏÂÁ

npm install –save-dev laravel-mix

×°ÖÃÀֳɺ󣬾ͿÉÒÔÔÚÏîĿĿ¼Ï¿´µ½node_modulesÎļþ¼ÐÖзºÆðÁËlaravel-mixÎļþ¼Ð¡£

Á¬Ã¦Ñ§Ï°¡°Ç°¶ËÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

¶þ¡¢ÉèÖÃLaravel Mix

ÒªÉèÖÃLaravel Mix£¬ÐèÒªÔÚÏîÄ¿¸ùĿ¼½¨ÉèÒ»¸öwebpack.mix.jsÎļþ¡£¸ÃÎļþ¾ÍÊÇÓÃÀ´½ç˵ÐèÒª±àÒëµÄ×ÊÔ´ÎļþÒÔ¼°±àÒëºóµÄÊä³ö·¾¶µÈ¡£

ÒÔÏÂÊÇÒ»¸ö»ù±¾µÄwebpack.mix.jsÉèÖÃÎļþ£º

const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');

µÇ¼ºó¸´ÖÆ

¸ÃÉèÖÃÎļþÖУ¬Ê¹ÓÃÁËLaravel MixÌṩµÄjsÒªÁìºÍsassÒªÁ죬ËüÃǶ¼½ÓÊÜÁ½¸ö²ÎÊý£ºÔ´Îļþ·¾¶ºÍÊä³öÎļþ·¾¶¡£ÀýÈ磬ÉÏÃæµÄÉèÖÃÎļþÖ¸¶¨Á˽«resources/js/app.jsÎļþ±àÒë³Épublic/js/app.jsÎļþ£¬½«resources/sass/app.scssÎļþ±àÒë³Épublic/css/app.cssÎļþ¡£

³ýÁËÒÔÉÏʾÀýÖÐÌáµ½µÄ±àÒëjsºÍsassÎļþÍ⣬Laravel Mix»¹ÌṩÁËÐí¶àÆäËû×ÊÔ´ÎļþµÄ±àÒëÒªÁ죬ÀýÈçless¡¢stylus¡¢postcssµÈ¡£±ðµÄ£¬»¹¿ÉÒÔʹÓÃһЩLaravel MixÌṩµÄ¹¤¾ßÒªÁ죬ÀýÈçversion¡¢browserSync¡¢copyµÈ£¬À´¾ÙÐÐÇ°¶Ë×ÊÔ´µÄ°æ±¾¿ØÖÆ¡¢ä¯ÀÀÆ÷ͬ²½¡¢Îļþ¸´ÖƵȲÙ×÷¡£

Èý¡¢ÔËÐÐLaravel Mix

ÔÚÍê³ÉLaravel MixµÄÉèÖú󣬾ͿÉÒÔÔËÐÐËüÀ´±àÒëÇ°¶Ë×ÊÔ´ÁË¡£Laravel MixÌṩÁ˶à¸öÏÂÁîÀ´Æô¶¯²î±ðµÄ±àÒë·½·¨£¬¿ÉÒÔƾ֤ÏÖʵÐèҪѡÔñʹÓá£

ÀýÈ磬ҪÔËÐÐwebpackµÄwatchģʽÀ´ÊµÊ±¼à¿Ø×ÊԴת±ä²¢×Ô¶¯±àÒ룬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

npm run watch

ÒªÌìÉúÉú²úÇéÐÎϵÄ×îÖÕÎļþ£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

npm run prod

±ðµÄ£¬ÉÐÓÐdevÏÂÁî¡¢hotÏÂÁîµÈ£¬¿ÉÒԲο¼Laravel MixÎĵµ¾ÙÐÐÏàʶºÍʹÓá£

×ܽ᣺

Laravel MixÊÇLaravel¿ò¼ÜÖм¯³ÉµÄÒ»¿îÇ°¶Ë×ÊÔ´±àÒ빤¾ß£¬ÌṩÁ˾«Á·Ò×ÓõÄAPIºÍÇ¿Ê¢µÄ¹¦Ð§£¬¿ÉÒÔÀû±ãµØ¶ÔÇ°¶Ë×ÊÔ´¾ÙÐбàÒëºÍÖÎÀí¡£Ê¹ÓÃLaravel Mix£¬¿ÉÒÔÈÃÇ°¶Ë×ÊÔ´µÄ±àÒë±äµÃ¼òÆÓ¶ø¸ßЧ¡£

ÒÔÉϾÍÊÇLaravel¿ª·¢£ºÔõÑùʹÓÃLaravel Mix±àÒëÇ°¶Ë×ÊÔ´£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ