
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Laravel Tutorials Archives - TECHNIG</title>
	<atom:link href="https://www.technig.com/tag/laravel-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.technig.com/tag/laravel-tutorials/</link>
	<description>Gateway for IT Experts and Tech Geeks</description>
	<lastBuildDate>Thu, 12 Oct 2017 09:30:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.technig.com/wp-content/uploads/2020/04/32x32.png</url>
	<title>Laravel Tutorials Archives - TECHNIG</title>
	<link>https://www.technig.com/tag/laravel-tutorials/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">162720667</site>	<item>
		<title>How to Use Laravel Mix without Laravel Step by Step</title>
		<link>https://www.technig.com/use-laravel-mix-without-laravel/</link>
					<comments>https://www.technig.com/use-laravel-mix-without-laravel/#respond</comments>
		
		<dc:creator><![CDATA[Hujatulla Asghari]]></dc:creator>
		<pubDate>Thu, 12 Oct 2017 09:30:08 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS Solution]]></category>
		<category><![CDATA[CSS Tips]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Laravel Tutorials]]></category>
		<category><![CDATA[Nodejs]]></category>
		<category><![CDATA[NPM Package]]></category>
		<category><![CDATA[Small Business Web Design]]></category>
		<category><![CDATA[Web Designing]]></category>
		<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[Web Development Company]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=11966</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"><img width="840" height="420" src="https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="How to Use Laravel Mix without Laravel - Technig" decoding="async" fetchpriority="high" srcset="https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel.jpg 840w, https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel-300x150.jpg 300w, https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel-768x384.jpg 768w" sizes="(max-width: 840px) 100vw, 840px" /></div>
<p>Laravel Mix is a powerful tool and NPM package. So, using Laravel Mix, you can compile sass, scss files, Vuejs files and ES6 features. Also, it&#8217;s fast and easy to start using. Besides, you can easily customizer Laravel Mix for your project. So, in this tutorial, you&#8217;ll learn how to use Laravel Mix without Laravel [&#8230;]</p>
<p>The post <a href="https://www.technig.com/use-laravel-mix-without-laravel/">How to Use Laravel Mix without Laravel Step by Step</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"><img width="840" height="420" src="https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="How to Use Laravel Mix without Laravel - Technig" decoding="async" loading="lazy" srcset="https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel.jpg 840w, https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel-300x150.jpg 300w, https://www.technig.com/wp-content/uploads/2017/10/How-to-Use-Laravel-Mix-without-Laravel-768x384.jpg 768w" sizes="(max-width: 840px) 100vw, 840px" /></div><p>Laravel Mix is a powerful tool and NPM package. So, using Laravel Mix, you can compile sass, scss files, Vuejs files and ES6 features. Also, it&#8217;s fast and easy to start using. Besides, you can easily customizer Laravel Mix for your project. So, in this tutorial, you&#8217;ll learn how to use Laravel Mix without Laravel project. The latest version of Laravel projects has pre-install Laravel Mix.</p>
<h2>Use Laravel Mix without Laravel Step by Step</h2>
<p>We are going to do everything step by step on how you can use Laravel Mix without Laravel, so you will not miss anything.</p>
<p><strong>Requirements:</strong></p>
<p>We require the following criteria. If you want to follow the tutorial to make sure you have the NPM and Nodejs installed on your system. If you don&#8217;t have installed those, then go to <a href="https://nodejs.org/" rel="noopener">nodejs.org</a>, download and install. It will not take more than 2 minutes. Besides, you must have basic knowledge of NPM usage.</p>
<h3>1. Create a Project</h3>
<p>Simply, create a folder anywhere on your computer. Then run the following command to initialize NPM files.</p>
<pre class="lang:default decode:true">npm init -y</pre>
<p>The command creates a package.Json file in your folder with simple boilerplate. <strong>Then</strong>, open your project in your favorite text editor.</p>
<h3>2. Install NPM Packages</h3>
<p>Now, let&#8217;s install a few NPM package plus Laravel Mix. <strong>So</strong>, we&#8217;re going to install all of them at once. To do so, list your packages name in your package.json file.</p>
<p>So, open your <strong>package.json</strong> file and add the following code. We will install a few essential packages.</p>
<pre class="theme:sublime-text lang:java decode:true">{
  "name": "laravel-mix",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "laravel-mix": "^1.0",
        "bootstrap-sass": "^3.3.7",
        "cross-env": "^5.0.1",
        "jquery": "^3.1.1",
        "vue": "^2.1.10"
  },

  "keywords": [],
  "author": "",
  "license": "ISC"
}
</pre>
<p>So, your<strong> package.json</strong> file should look like the above. The <strong>devDependencies</strong> part is the list of packages we want to install. So, run now <strong>run</strong> the following command in your command line to download the packages.</p>
<pre class="lang:default decode:true">npm install</pre>
<p>It will take a while to install the packages, so be patient. So, after installing completed, continue the next step.</p>
<h3>3. Configure the Laravel Mix Files</h3>
<p>After installing the packages, now you can start creating Laravel mix files.</p>
<p>You go to &#8220;<span style="background-color: #c2c2c2;"><em>node_modules/laravel-mix/setup/webpack.mix.js&#8221;</em></span> and copy the <strong>webpack.mix.js</strong> file to the root directory of your project. Also, you can create the file yourself and add the following code inside.</p>
<p><strong>webpack.mix.js</strong></p>
<pre class="theme:sublime-text lang:js decode:true">let mix = require('laravel-mix');

mix.js('src/app.js', 'dist/')
   .sass('src/app.scss', 'dist/');</pre>
<p>The above just require Laravel mix, then look in &#8220;<strong>src/app.js</strong>&#8221; and compile to &#8220;<strong>dist/</strong>&#8221; folder. So, we need the create those files.</p>
<figure id="attachment_11973" aria-describedby="caption-attachment-11973" style="width: 660px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/10/Laravel-Mix-Folder-Structure.png"><img decoding="async" class="wp-image-11973" src="http://3.90.216.52/wp-content/uploads/2017/10/Laravel-Mix-Folder-Structure.png" alt="Laravel Mix Folder Structure" width="660" height="306" srcset="https://www.technig.com/wp-content/uploads/2017/10/Laravel-Mix-Folder-Structure.png 731w, https://www.technig.com/wp-content/uploads/2017/10/Laravel-Mix-Folder-Structure-300x139.png 300w" sizes="(max-width: 660px) 100vw, 660px" /></a><figcaption id="caption-attachment-11973" class="wp-caption-text">Laravel Mix Folder Structure</figcaption></figure>
<h3>4. Add Code to Compile</h3>
<p>Now let&#8217;s add some code our <strong>app.js</strong> file to compile and test if everything is working.</p>
<p>So, add the following code in your app.js file. It&#8217;s just for the demo, of course, you can add any code you want.</p>
<pre class="theme:sublime-text lang:js decode:true">window.$ = window.jQuery = require('jquery');
require('bootstrap-sass');

</pre>
<p>The code will add jQuery and bootstrap file.</p>
<p><strong>Now</strong>, open your command line and run the following code.</p>
<pre class="lang:default decode:true">npm run production</pre>
<p>The <strong><em>production</em> </strong>and other command list are written in<strong> the package.Json</strong> file.</p>
<p>For me, the compilation starts and go till 95%. Then it stopped.</p>
<figure id="attachment_11976" aria-describedby="caption-attachment-11976" style="width: 525px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/10/Laravel-mix-stop-at-emitting.png"><img decoding="async" class="wp-image-11976" src="http://3.90.216.52/wp-content/uploads/2017/10/Laravel-mix-stop-at-emitting.png" alt="Laravel mix stop at emitting" width="525" height="215" srcset="https://www.technig.com/wp-content/uploads/2017/10/Laravel-mix-stop-at-emitting.png 872w, https://www.technig.com/wp-content/uploads/2017/10/Laravel-mix-stop-at-emitting-300x123.png 300w, https://www.technig.com/wp-content/uploads/2017/10/Laravel-mix-stop-at-emitting-768x314.png 768w" sizes="(max-width: 525px) 100vw, 525px" /></a><figcaption id="caption-attachment-11976" class="wp-caption-text">Laravel mix stop at emitting</figcaption></figure>
<p>It&#8217;s not going further. So, there must be a problem.</p>
<h2>5. How to Fix Laravel Mix 95% emitting Stop Problem</h2>
<p>So, let&#8217;s fix it. Before doing that, you know know what&#8217;s the problem. Thus, it can&#8217;t find the public folder or where to compile the files. Here is how you fix it.</p>
<p>Open your <strong>webpack.mix.js</strong> file and add the following code<strong> right after</strong> you require Laravel Mix.</p>
<pre class="theme:sublime-text lang:js decode:true">mix.options({
    publicPath: 'dist'
})
</pre>
<p>Now, terminate the emitting process by pressing Ctrl + C two times and re-run the production command. It should work now.</p>
<h3>Conclusion</h3>
<p>We hope this article has been informative for you and you enjoyed reading. So, it&#8217; how you can use Laravel Mix without Laravel. Further, we have a forum where you can ask any types of questions and get instant answers. So, feel free to join us.</p>
<p>The post <a href="https://www.technig.com/use-laravel-mix-without-laravel/">How to Use Laravel Mix without Laravel Step by Step</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/use-laravel-mix-without-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">11966</post-id>	</item>
	</channel>
</rss>
