Skip to content

Commit ced9cd9

Browse files
committed
Update docs for 1.0
1 parent 11f4717 commit ced9cd9

File tree

9 files changed

+18
-58
lines changed

9 files changed

+18
-58
lines changed

docs/autoloading.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mix.autoload({
66
});
77
```
88

9-
webpack offers the necessary facilities to make a module available as a variable in every other module required by webpack. If you're working with a particular plugin or library that depends upon a global variable, such as jQuery, `mix.autoload()` may prove useful to you.
9+
Webpack offers the necessary facilities to make a module available as a variable in every other module required by webpack. If you're working with a particular plugin or library that depends upon a global variable, such as jQuery, `mix.autoload()` may prove useful to you.
1010

1111
Consider the following example:
1212

docs/basic-example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Done. Simple, right?
1818

1919
With this configuration in place, we may trigger webpack from the command line: `node_modules/.bin/webpack`.
2020

21-
During development, it's unnecessary to minify the output, however, this will be performed automatically when you trigger webpack within a production environment: `export NODE_ENV=production && webpack`.
21+
During development, it's unnecessary to minify the output, however, this will be performed automatically when you trigger webpack within a production environment: `export NODE_ENV=production webpack`.
2222

2323
### Less?
2424

docs/concatenation-and-minification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mix.minify(['this/one.js', 'and/this/one.js']);
3838

3939
There are a few things worth noting here:
4040

41-
1. This method will overwrite the existing file.
41+
1. This method will create a companion `*.min.ext` file. So minifying `app.js` will generate `app.min.js`.
4242
2. Once again, the minification will only take place during a production build. \(`export NODE_ENV=production`\).
4343
3. There is no need to call `mix.combine(['one.js', 'two.js'], 'merged.js').minify('merged.js');`Just stick with the single `mix.combine()` call. It'll take care of both.
4444

docs/faq.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ No. It has a few optimizations for Laravel, but it can be used for any project.
66

77
### My code isn't being minified.
88

9-
Minification will only be performed, when your `NODE_ENV` is set to production. Not only will this speed up your compilation time, but it's also unnecessary during development. Here's an example of running webpack for production.
9+
Minification will only be performed, when your `NODE_ENV` is set to *production*. Not only will this speed up your compilation time, but it's also unnecessary during development. Here's an example of running webpack for production.
1010

1111
```bash
1212
export NODE_ENV=production && webpack --progress --hide-modules
@@ -16,10 +16,10 @@ It's highly recommended that you add the following NPM scripts to your `package.
1616

1717
```js
1818
"scripts": {
19-
"dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
20-
"watch": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules",
21-
"hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot",
22-
"production": "cross-env NODE_ENV=production webpack --progress --hide-modules"
19+
"dev": "NODE_ENV=development webpack --progress --hide-modules",
20+
"watch": "NODE_ENV=development webpack --watch --progress --hide-modules",
21+
"hot": "NODE_ENV=development webpack-dev-server --inline --hot",
22+
"production": "NODE_ENV=production webpack --progress --hide-modules"
2323
},
2424
```
2525

docs/laravel-elixir-vs-mix.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/mixjs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mix.js(src|[src], output)
66

77
With a single line of code, Laravel Mix allows you to trigger a number of vital actions.
88

9-
* ES2015 + modules compilation
9+
* ES2017 + modules compilation
1010
* Build and compile `.vue` components \(via `vue-loader`\)
1111
* Hot module replacement
1212
* Tree-shaking, new in webpack 2 \(removes unused library code\)
@@ -117,4 +117,4 @@ Laravel Mix also ships with basic React support. Simply update your `mix.js()` c
117117
mix.react('resources/assets/js/app.jsx', 'public/js/app.js');
118118
```
119119

120-
Of course, you'll still want to install React and ReactDOM through NPM, per usual, but everything else should be taken care of.
120+
Of course, you'll still want to install React and ReactDOM through NPM, per usual, but everything else should be taken care of.

docs/readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* [Basic Example](basic-example.md)
55
* [Installation](installation.md)
66
* [Laravel Workflow](workflow.md)
7-
* [Laravel Mix vs. Laravel Elixir](laravel-elixir-vs-mix.md)
87
* [FAQ](faq.md)
98

109
## API

docs/versioning.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ mix.js('src', 'output')
55
.version([]);
66
```
77

8-
To assist with long-term caching, Laravel Mix provides the `mix.version()` method, which enables file name hashing. such as `app.8e5c48eadbfdd5458ec6.js`. This is useful for cache-busting. Imagine that your server automatically caches scripts for a year, to improve performance. That's great, but, each time you make a change to your application code, you need some way to instruct the server to bust the cache. This is typically done through the use of query strings, or file hashing.
8+
To assist with long-term caching, Laravel Mix provides the `mix.version()` method, which enables file hashing. such as `app.js?id=8e5c48eadbfdd5458ec6`. This is useful for cache-busting. Imagine that your server automatically caches scripts for a year, to improve performance. That's great, but, each time you make a change to your application code, you need some way to instruct the server to bust the cache. This is typically done through the use of query strings, or file hashing.
99

10-
With versioning enabled, each time your code changes, a new hashed file will be generated, and the old one will be deleted. Consider the following `webpack.mix.js` file.
10+
With versioning enabled, each time your code changes, a new hashed query string file will be generated. Consider the following `webpack.mix.js` file.
1111

1212
```js
1313
let mix = require('laravel-mix');
@@ -17,7 +17,7 @@ mix.js('resources/assets/js/app.js', 'public/js')
1717
.version();
1818
```
1919

20-
Upon compilation, you'll see `./public/css/app.8e5c48eadbfdd5458ec6.css` and .`/public/js/app.8e5c48eadbfdd5458ec6.js`. Of course, your particular hash will be unique. Each time you adjust your JavaScript, the compiled files will receive a newly hashed name, which will effectively bust the cache, once pushed to production.
20+
Upon compilation, you'll see `/css/app.css?id=5ee7141a759a5fb7377a` and `/js/app.js?id=0441ad4f65d54589aea5` in your `mix-manifest.json` file. Of course, your particular hash will be unique. Each time you adjust your JavaScript, the compiled files will receive a newly hashed name, which will effectively bust the cache, once pushed to production.
2121

2222
As an example, try running`webpack --watch`, and then change a bit of your JavaScript. You'll instantly see a newly generated bundle and stylesheet.
2323

docs/workflow.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Think of this file as your home base for all front-end configuration.
2121
```js
2222
let mix = require('laravel-mix');
2323

24-
mix.js('resources/assets/js/app.js', 'public/js');
25-
mix.sass('resources/assets/sass/app.scss', 'public/css');
24+
mix.js('resources/assets/js/app.js', 'public/js')
25+
.sass('resources/assets/sass/app.scss', 'public/css');
2626
```
2727

28-
By default, we've enabled JavaScript ES2015 + module bundling, as well as Sass compilation.
28+
By default, we've enabled JavaScript ES2017 + module bundling, as well as Sass compilation.
2929

3030
### Step 4: Compilation
3131

@@ -54,6 +54,8 @@ npm run watch
5454

5555
Laravel ships with a `./resources/assets/js/components/Example.vue` file. Give it a tweak, and wait for the OS notification, which signals that the compilation has completed. Great!
5656

57+
> Tip: You may also use `mix.browserSync('myapp.dev')` to automatically reload the browser when any relevant file in your Laravel app is changed.
58+
5759
### Step 5: Update Your View
5860

5961
Again, Laravel ships with a welcome page. We can use this for our demo. Update it to:
@@ -78,18 +80,3 @@ Again, Laravel ships with a welcome page. We can use this for our demo. Update i
7880
```
7981

8082
And reload the page in your browser. Great! It works.
81-
82-
### Step 6: Hot Reloading
83-
84-
It would be nice if we could update a Vue component, and instantly see it refresh in the browser, without having to perform a manual refresh. Even better, it would be nice if this refresh didn't reset our component's state. Well, hot module replacement to the rescue!
85-
86-
Return to the command line, and hit `Ctrl+c` to cancel the webpack watcher. Instead, we'll run:
87-
88-
```bash
89-
npm run hot
90-
```
91-
92-
"hot" stands for "hot module replacement." This command is the only thing you have to do to activate automatic reloading. Return to your browser, give it a refresh, and then return to your editor to modify the `./resources/assets/js/components/Example.vue` file. Change the template however you wish, and watch as the browser instantly refreshes to reflect your change \(once you hit save, of course\). Amazing!
93-
94-
95-

0 commit comments

Comments
 (0)