aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndrajith K L2017-11-02 13:31:13 +0530
committerIndrajith K L2017-11-02 13:31:13 +0530
commit70a7e6c3c2019346ea8ad5c52feb464efa0531e5 (patch)
tree4bf9315ab9979481c631775007ec3ff05d1ee61e
downloades6-backbone-70a7e6c3c2019346ea8ad5c52feb464efa0531e5.tar.gz
es6-backbone-70a7e6c3c2019346ea8ad5c52feb464efa0531e5.tar.bz2
es6-backbone-70a7e6c3c2019346ea8ad5c52feb464efa0531e5.zip
Initial Commit ES6 barebone
-rw-r--r--.babelrc3
-rw-r--r--.editorconfig9
-rw-r--r--.eslintignore1
-rw-r--r--.eslintrc31
-rw-r--r--.gitignore4
-rw-r--r--LICENSE0
-rw-r--r--README.md1
-rw-r--r--index.html14
-rw-r--r--package.json35
-rw-r--r--src/index.js13
-rw-r--r--src/myview.js26
-rw-r--r--src/view.js28
-rw-r--r--webpack.config.js19
13 files changed, 184 insertions, 0 deletions
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
--- /dev/null
+++ b/LICENSE
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 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>ES6 Boilerplate</title>
+</head>
+<body>
+ <div id="main"></div>
+ <li></li>
+
+ <script type="text/javascript" src="dist/bundle.js"></script>
+</body>
+</html>
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 <mac91112@gmail.com>",
+ "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 = '<div id="myarea"></div>'
+ 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
+ }
+};