Skip to content

Commit ecc89ef

Browse files
author
Panneerselvam
committed
first commit
0 parents  commit ecc89ef

File tree

158 files changed

+8588
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+8588
-0
lines changed

.appveyor.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Test against all supported versions of Node.js on windows
2+
environment:
3+
matrix:
4+
- nodejs_version: '8'
5+
- nodejs_version: '9'
6+
- nodejs_version: '10'
7+
8+
cache:
9+
- node_modules
10+
- '%APPDATA%\npm-cache'
11+
12+
# Install scripts. (runs after repo cloning)
13+
install:
14+
# Get the version of Node.js
15+
- ps: Install-Product node $env:nodejs_version
16+
- npm install --global npm@latest
17+
- npm ci
18+
19+
# Post-install test scripts.
20+
test_script:
21+
# Output useful info for debugging.
22+
- node --version
23+
- npm --version
24+
# run tests
25+
- npm test
26+
27+
# Don't actually build.
28+
build: off

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test/fixtures/fake-app/resources/assets/dynamic/dynamic.js
2+
test/fixtures/fake-app/resources/assets/extract/app.js

.eslintrc

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 6,
4+
"sourceType": "module"
5+
},
6+
"env": {
7+
"node": true
8+
},
9+
"rules": {
10+
"no-const-assign": "error",
11+
"newline-before-return": "error",
12+
"semi":"error",
13+
"no-unreachable": "error",
14+
"no-extra-semi": "error",
15+
"no-unexpected-multiline": "error",
16+
"comma-dangle": ["error", {
17+
"arrays": "never",
18+
"objects": "never",
19+
"imports": "never",
20+
"exports": "never",
21+
"functions": "never"
22+
}]
23+
}
24+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
notes.md
3+
coverage
4+
.nyc_output
5+
.idea/
6+
*.log
7+
package-lock.json
8+
yarn.lock

.huskyrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "pretty-quick --staged"
4+
}
5+
}

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.nyc_output

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"endOfLine": "lf",
3+
"singleQuote": true,
4+
"tabWidth": 4,
5+
"semi": true
6+
}

.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: node_js
2+
3+
# Test linux and osx
4+
os:
5+
- linux
6+
- osx
7+
8+
# Test against all supported versions of Node.js
9+
node_js:
10+
- '8'
11+
- '10'
12+
- '12'
13+
- '13'
14+
15+
# Run ESLint after npm test
16+
script:
17+
- npm run eslint
18+
19+
cache:
20+
directories:
21+
- 'node_modules'

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Jeffrey Way <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

docs/.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Node rules:
2+
## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
3+
.grunt
4+
5+
## Dependency directory
6+
## Commenting this out is preferred by some people, see
7+
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
8+
node_modules
9+
10+
# Book build output
11+
_book
12+
13+
# eBook build output
14+
*.epub
15+
*.mobi
16+
*.pdf

docs/autoloading.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Autoloading
2+
3+
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.
4+
5+
Consider the following example:
6+
7+
```js
8+
mix.autoload({
9+
jquery: ['$', 'window.jQuery']
10+
});
11+
```
12+
13+
This snippet specifies that webpack should prepend `var $ = require('jquery')` to every location that it encounters either the global `$` identifier, or `window.jQuery`. Nifty!

docs/basic-example.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Basic Example
2+
3+
Laravel Mix is a clean layer on top of webpack to make the 80% use case laughably simple to execute. Most would agree that, though incredibly powerful, webpack ships with a steep learning curve. But what if you didn't have to worry about that?
4+
5+
Have a look at a basic `webpack.mix.js` file. Let's imagine that we only desire JavaScript \(ES2015 with modules\), and Sass compilation:
6+
7+
```js
8+
let mix = require('laravel-mix');
9+
10+
mix.sass('src/app.sass', 'dist').js('src/app.js', 'dist');
11+
```
12+
13+
Done. Simple, right?
14+
15+
1. Compile the Sass file, `./src/app.sass`, to `./dist/app.css`
16+
2. Bundle all JavaScript \(and any required modules\) at `./src/app.js` to `./dist/app.js`.
17+
18+
With this configuration in place, we may trigger webpack from the command line: `node_modules/.bin/webpack`.
19+
20+
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+
22+
### Less?
23+
24+
But what if you prefer Less compilation instead? No problem. Just swap `mix.sass()` with `mix.less()`, and you're done!
25+
26+
You'll find that most common webpack tasks become a cinch with Laravel Mix.

docs/browsersync.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# BrowserSync
2+
3+
```js
4+
mix.browserSync('my-site.test');
5+
```
6+
7+
BrowserSync will automatically monitor your files for changes, and insert your changes into the browser - all without requiring a manual refresh. You may enable support by calling the `mix.browserSync()` method, like so:
8+
9+
```js
10+
mix.browserSync('my-domain.test');
11+
12+
// Or:
13+
14+
// https://browsersync.io/docs/options/
15+
mix.browserSync({
16+
proxy: 'my-domain.test'
17+
});
18+
```
19+
20+
You may pass either a string (proxy) or object (BrowserSync settings) to this method. The domain name you declare as your proxy is vital. This will proxy output from webpack Dev Server through BrowserSync.
21+
22+
Other options can be seen in the [Browsersync Documentation](https://browsersync.io/docs/options/).
23+
24+
Now, boot up the dev server (`npm run watch`), and you're all set go!
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Concatenation and Minification
2+
3+
```js
4+
mix.combine(['src', 'files'], 'destination');
5+
mix.babel(['src', 'files'], destination);
6+
mix.minify('src');
7+
mix.minify(['src']);
8+
```
9+
10+
If used properly, Laravel Mix and webpack should take care of all the necessary module bundling and minification for you. However, you may have some legacy code or vendor libraries that need to be concatenated and minified. Not a problem.
11+
12+
### Combine Files
13+
14+
Consider the following snippet:
15+
16+
```js
17+
mix.combine(['one.js', 'two.js'], 'merged.js');
18+
```
19+
20+
This will naturally merge `one.js` and `two.js` into a single file, called `merged.js`. As always, during development, that merged file will remain uncompressed. However, for production \(`export NODE_ENV=production`\), this command will additionally minify `merged.js`.
21+
22+
#### Combine Files With Babel Compilation
23+
24+
If you need to concatenate JavaScript files that have been written in ES2015, you may update your `mix.combine()` call to `mix.babel()`. The method signature is identical. The only difference is that, after the files have been concatenated, Laravel Mix will perform Babel compilation on the result to transform the code to vanilla JavaScript that all browsers can understand.
25+
26+
```js
27+
mix.babel(['one.js', 'two.js'], 'merged.js');
28+
```
29+
30+
### Minify Files
31+
32+
Similarly, you may also minify one or more files with the `mix.minify()` command.
33+
34+
```js
35+
mix.minify('path/to/file.js');
36+
mix.minify(['this/one.js', 'and/this/one.js']);
37+
```
38+
39+
There are a few things worth noting here:
40+
41+
1. This method will create a companion `*.min.ext` file. So minifying `app.js` will generate `app.min.js`.
42+
2. Once again, the minification will only take place during a production build. \(`export NODE_ENV=production`\).
43+
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.
44+
45+
> **Important**: Please note that minification is only available for CSS and JavaScript files. The minifier will not understand any other provided file type.

docs/copying-files.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copying Files
2+
3+
```js
4+
mix.copy(from, to);
5+
mix.copy('from/regex/**/*.txt', to);
6+
mix.copy([path1, path2], to);
7+
mix.copyDirectory(fromDir, toDir);
8+
```
9+
10+
From time to time, you'll want to copy one or more files, as part of your build process. No problem; that's a cinch. Use the mix.copy\(\) method to specify the source file or folder, and then your desired destination.
11+
12+
```js
13+
mix.copy('node_modules/vendor/acme.txt', 'public/js/acme.txt');
14+
```
15+
16+
Upon compilation, the "acme" file will be copied to `public/js/acme.txt`, accordingly. A common use case for this is when you wish to move a set of fonts, installed through NPM, to your public directory.

0 commit comments

Comments
 (0)