Skip to content

Commit eb289b4

Browse files
committed
tweak js bootstrapping
1 parent 0699994 commit eb289b4

File tree

3 files changed

+48
-17
lines changed

3 files changed

+48
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"laravel-elixir-webpack-official": "^1.0.2"
1212
},
1313
"dependencies": {
14+
"jquery": "^2.2.4",
1415
"js-cookie": "^2.1.2",
1516
"vue": "^1.0.26",
1617
"vue-resource": "^0.9.3"

resources/assets/js/app.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11

2-
window.Cookies = require('js-cookie');
3-
42
/**
5-
* Vue.js
6-
*
7-
* Vue is a modern JavaScript for building interactive web interfaces using
8-
* reacting data binding and reusable components. Vue's API is clean and
9-
* simple, leaving you to focus only on building your next great idea.
3+
* First we will load all of this project's JavaScript dependencies which
4+
* include Vue and Vue Resource. This gives a great starting point for
5+
* building robust, powerful web applications using Vue and Laravel.
106
*/
11-
window.Vue = require('vue');
127

13-
require('vue-resource');
8+
require('./bootstrap');
149

1510
/**
16-
* The XSRF Header
17-
*
18-
* We'll register a HTTP interceptor to attach the "XSRF" header to each of
19-
* the outgoing requests issued by this application. The CSRF middleware
20-
* included with Laravel will automatically verify the header's value.
11+
* Next, we will create a fresh Vue application instance and attach it to
12+
* the body of the page. From here, you may begin adding components to
13+
* the application, or feel free to tweak this setup for your needs.
2114
*/
22-
Vue.http.interceptors.push(function (request, next) {
23-
request.headers['X-XSRF-TOKEN'] = Cookies.get('XSRF-TOKEN');
2415

25-
next();
16+
var app = new Vue({
17+
el: 'body',
18+
19+
ready() {
20+
console.log('Application ready.');
21+
}
2622
});

resources/assets/js/bootstrap.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
window.Cookies = require('js-cookie');
3+
4+
/**
5+
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
6+
* for JavaScript based Bootstrap features such as modals and tabs. This
7+
* code may be modified to fit the specific needs of your application.
8+
*/
9+
10+
window.$ = window.jQuery = require('jquery');
11+
12+
require('bootstrap-sass/assets/javascripts/bootstrap');
13+
14+
/**
15+
* Vue is a modern JavaScript for building interactive web interfaces using
16+
* reacting data binding and reusable components. Vue's API is clean and
17+
* simple, leaving you to focus only on building your next great idea.
18+
*/
19+
20+
window.Vue = require('vue');
21+
22+
require('vue-resource');
23+
24+
/**
25+
* We'll register a HTTP interceptor to attach the "XSRF" header to each of
26+
* the outgoing requests issued by this application. The CSRF middleware
27+
* included with Laravel will automatically verify the header's value.
28+
*/
29+
30+
Vue.http.interceptors.push(function (request, next) {
31+
request.headers['X-XSRF-TOKEN'] = Cookies.get('XSRF-TOKEN');
32+
33+
next();
34+
});

0 commit comments

Comments
 (0)