From 70a7e6c3c2019346ea8ad5c52feb464efa0531e5 Mon Sep 17 00:00:00 2001
From: Indrajith K L
Date: Thu, 2 Nov 2017 13:31:13 +0530
Subject: Initial Commit ES6 barebone
---
.babelrc | 3 +++
.editorconfig | 9 +++++++++
.eslintignore | 1 +
.eslintrc | 31 +++++++++++++++++++++++++++++++
.gitignore | 4 ++++
LICENSE | 0
README.md | 1 +
index.html | 14 ++++++++++++++
package.json | 35 +++++++++++++++++++++++++++++++++++
src/index.js | 13 +++++++++++++
src/myview.js | 26 ++++++++++++++++++++++++++
src/view.js | 28 ++++++++++++++++++++++++++++
webpack.config.js | 19 +++++++++++++++++++
13 files changed, 184 insertions(+)
create mode 100644 .babelrc
create mode 100644 .editorconfig
create mode 100644 .eslintignore
create mode 100644 .eslintrc
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 index.html
create mode 100644 package.json
create mode 100644 src/index.js
create mode 100644 src/myview.js
create mode 100644 src/view.js
create mode 100644 webpack.config.js
diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..a0765e1
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["es2015"]
+}
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..3c44241
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,9 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..53c37a1
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1 @@
+dist
\ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..4a9168b
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,31 @@
+
+{
+ "rules": {
+ "indent": [
+ 2,
+ 4
+ ],
+ "linebreak-style": [
+ 2,
+ "unix"
+ ],
+ "semi": [
+ 2,
+ "always"
+ ]
+ },
+ "env": {
+ "es6": true,
+ "browser": true,
+ "node": true,
+ "mocha": true
+ },
+ "extends": "eslint:recommended",
+ "ecmaFeatures": {
+ "modules": true
+ },
+ "parserOptions": {
+ "ecmaVersion": 6,
+ "sourceType": "module"
+ }
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..69c3972
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+node_modules
+.DS_Store
+*.log
+/dist
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e69de29
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..66013f4
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# ES6-backbone
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..319071c
--- /dev/null
+++ b/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+ ES6 Boilerplate
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..f7c89fc
--- /dev/null
+++ b/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "backbone-es6",
+ "version": "1.0.0",
+ "description": "Backbone JS es6 Template",
+ "main": "index.js",
+ "scripts": {
+ "start": "npm-run-all --parallel dev:server lint:watch",
+ "dev:server": "webpack-dev-server --hot --inline",
+ "watch": "webpack -w -d",
+ "build": "webpack -p",
+ "lint": "node_modules/.bin/esw webpack.config.* src --color",
+ "lint:watch": "npm run lint -- --watch"
+ },
+ "keywords": [
+ "es6"
+ ],
+ "author": "Indrajith K L ",
+ "license": "MIT",
+ "devDependencies": {
+ "babel-core": "^6.26.0",
+ "babel-loader": "^7.1.2",
+ "babel-preset-es2015": "^6.24.1",
+ "eslint": "^3.5.0",
+ "eslint-watch": "^2.1.14",
+ "npm-run-all": "^4.0.2",
+ "webpack": "^3.8.1",
+ "webpack-dev-server": "^2.9.3"
+ },
+ "dependencies": {
+ "backbone": "^1.3.3",
+ "jquery": "^3.2.1",
+ "mustache": "^2.3.0",
+ "underscore": "^1.8.3"
+ }
+}
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..f29efc1
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,13 @@
+import Backbone from 'backbone';
+import TestView from './view';
+import _ from 'underscore';
+
+Backbone.history.start();
+
+class Index {
+ constructor() {
+ new TestView();
+ }
+}
+
+new Index();
diff --git a/src/myview.js b/src/myview.js
new file mode 100644
index 0000000..026f563
--- /dev/null
+++ b/src/myview.js
@@ -0,0 +1,26 @@
+import Backbone from 'backbone';
+import * as _ from 'underscore';
+import $ from 'jquery';
+import Mustache from 'mustache';
+
+
+export default class MyView extends Backbone.View {
+ constructor() {
+ super();
+ }
+
+ initialize() {
+ this.el = '#myarea';
+ this.$el = $(this.el);
+ this.template = 'Hello';
+ this.render();
+ }
+
+ render() {
+ console.log(this.el)
+ this.$el.html(Mustache.render(this.template));
+ }
+
+
+
+}
diff --git a/src/view.js b/src/view.js
new file mode 100644
index 0000000..399ac03
--- /dev/null
+++ b/src/view.js
@@ -0,0 +1,28 @@
+import Backbone from 'backbone';
+import * as _ from 'underscore';
+import $ from 'jquery';
+import Mustache from 'mustache';
+import MyView from './myview';
+
+
+export default class TestView extends Backbone.View {
+ constructor() {
+ super();
+ }
+
+ initialize() {
+ this.el = 'li';
+ this.$el = $(this.el);
+ this.template = ''
+ this.render();
+ }
+
+ render() {
+ console.log(this.el)
+ this.$el.html(Mustache.render(this.template));
+ new MyView();
+ }
+
+
+
+}
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..a251411
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,19 @@
+module.exports = {
+ entry: __dirname + '/src/index.js',
+ output: {
+ path: __dirname + '/dist',
+ publicPath: '/dist/',
+ filename: 'bundle.js'
+ },
+ module: {
+ rules: [{
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: 'babel-loader'
+ }]
+ },
+ devServer: {
+ contentBase: [ './' ],
+ watchContentBase: true
+ }
+};
--
cgit v1.2.3