Skip to content

Commit a1866a7

Browse files
committed
criando dois ambientes no gulpfile
1 parent 974d5ac commit a1866a7

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

gulpfile.js

+20-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const mergeWebpack = require('webpack-merge');
88
const env = require('gulp-env');
99
const stringifyObject = require('stringify-object');
1010
const file = require('gulp-file');
11+
const argv = require('yargs').argv;
1112
const HOST = "localhost";
1213

1314
/*require('laravel-elixir-vue');
@@ -30,10 +31,12 @@ Elixir.webpack.mergeConfig(webpackDevConfig);*/
3031
*/
3132

3233
gulp.task('spa-config',()=>{
33-
env({
34-
file: '.env',
35-
type: 'ini'
36-
});
34+
if(argv._.includes('watch')){
35+
env({
36+
file: '.env',
37+
type: 'ini'
38+
});
39+
}
3740
let spaConfig = require('./spa.config');
3841
let string = stringifyObject(spaConfig);
3942
return file('config.js', `module.exports = ${string};`, {src: true})
@@ -78,11 +81,18 @@ elixir(mix => {
7881
.sass('./resources/assets/site/sass/site.scss')
7982
.copy('./node_modules/materialize-css/fonts/roboto','./public/fonts/roboto');
8083

81-
gulp.start('spa-config','webpack-dev-server');
84+
if(argv._.includes('watch')){
85+
gulp.start('spa-config','webpack-dev-server');
86+
87+
mix.browserSync({
88+
host: HOST,
89+
proxy: `http://${HOST}:8080`
90+
});
91+
}else{
92+
gulp.start('spa-config');
93+
webpack(require('./webpack.config'),()=>{
94+
console.log("Bundling project..");
95+
});
96+
}
8297

83-
mix.browserSync({
84-
host: HOST,
85-
proxy: `http://${HOST}:8080`
86-
});
87-
//.webpack('app.js');
8898
});

public/build/spa.bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71881,7 +71881,7 @@
7188171881
_store2.default.dispatch('login', this.user).then(function () {
7188271882
_this.$router.go({ name: 'dashboard' });
7188371883
}).catch(function (responseError) {
71884-
console.log(responseError.data);
71884+
console.log(responseError.data.message);
7188571885
if (responseError.data && responseError.data.hasOwnProperty('error')) {
7188671886
_this.error.message = responseError.data.message;
7188771887
} else {

0 commit comments

Comments
 (0)