尊龙凯时人生就是搏

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
sitemap¡¢ÍøÕ¾µØͼ