Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同步代码 #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# editorconfig-tools is unable to ignore longs strings or urls
max_line_length = null
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ npm-debug.log
.sass-cache
*.css.map
yarn.lock
!/yarn.lock
!/yarn.lock
/recipes/webpack.babel/app/dist
11 changes: 8 additions & 3 deletions recipes/webpack.babel/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ var stripAnsi = require('strip-ansi');
* Require ./webpack.config.js and make a bundler from it
*/
var webpackConfig = require('./webpack.config');
var bundler = webpack(webpackConfig);
//console.log(webpackConfig);

var bundler = webpack(webpackConfig,(err, stats) => {
if (err || stats.hasErrors()) {
console.warn(err);
}
});
/**
* Reload all devices when bundle is complete
* or send a fullscreen error message to the browser instead
Expand All @@ -26,18 +31,18 @@ bundler.plugin('done', function(stats) {
}
browserSync.reload();
});

/**
* Run Browsersync and use middleware for Hot Module Replacement
*/
browserSync.init({
server: 'app',
open: false,
open: true,
logFileChanges: false,
middleware: [
webpackDevMiddleware(bundler, {
publicPath: webpackConfig.output.publicPath,
stats: { colors: true }
,quiet: true
})
],
plugins: ['bs-fullscreen-message'],
Expand Down
17 changes: 0 additions & 17 deletions recipes/webpack.babel/app/index.html

This file was deleted.

25 changes: 25 additions & 0 deletions recipes/webpack.babel/includes/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body.loading *{
display:none;
}
body.loading .loadingTip{
border-radius:5px;
display:block;
background-color:#a4a4a4;
color:#fff;
font-size:20px;
width:100px;
height:100px;
line-height:100px;
text-align:center;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
position: fixed;
}
body.loading .loadingTip p{
color:#fff;display:block;
}
body.loaded .loadingTip{
display:none;
}
120 changes: 120 additions & 0 deletions recipes/webpack.babel/includes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
;(function(){
window.VERSION = "#VERSION#";
window.PROTOCOL = "http";
if(window.location.href.indexOf("https:")>-1){
//window.location.href = window.location.href.replace(/https/, "http");
window.PROTOCOL = "https";
window.ISHTTPS = true;
}else{
window.ISHTTPS = false;
}
function loadJs(src){
var body = document.getElementsByTagName('body')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= src;
body.appendChild(script);
}
//loadJs(window.PROTOCOL+"://localhost:8000/CLodopfuncs.js");
//测试环境
if(window.location.href.indexOf("doc.mding.org")>-1){
window.HOSTNAME = window.PROTOCOL+'://dev.mding.org/gym';
window.PUSHNAME = window.PROTOCOL+'://dev.push.mding.org';
}
else if(window.location.href.indexOf("localhost")>-1||
window.location.href.indexOf("127.0.0.1")>-1 ||
window.location.href.indexOf("192.168.")>-1){
if(window.ISHTTPS == true){
window.HOSTNAME = '';
window.PUSHNAME = '';
//window.PUSHNAME = window.PROTOCOL+'://localhost:3000';//连接本地,local.app.js
}else{
window.HOSTNAME = window.PROTOCOL+'://dev.mding.org/gym';
window.PUSHNAME = window.PROTOCOL+'://dev.push.mding.org';
}
}
else{
window.HOSTNAME = window.PROTOCOL+'://tea.api.mding.org/gym';
window.PUSHNAME = window.PROTOCOL+'://tea.push.mding.org';
}
window.PRINT_PREVIEW = false;
//window.HOSTNAME = window.PROTOCOL+'://10.1.23.162:8080/gym';

//window.PUSHNAME = window.PROTOCOL+'://dev.push.mding.org:80';
//window.PUSHNAME = window.PROTOCOL+'://127.0.0.1:3000';
window.RESOURCE = {
"access.login":[
"scripts/controllers/access/login.min.js",
],
"access.signUp":[
"scripts/controllers/access/signUp.min.js",
],
"common.setting":["scripts/controllers/common/setting.min.js"],
"common.blocks":["scripts/controllers/common/blocks.min.js"],
"common.update":["scripts/controllers/common/update.min.js"],
"common.user":[
"scripts/controllers/common/user.min.js",
"views/common/user/modal.all.html"
],
"fonter.modal":[
"views/fonter/modal.all.html",
"scripts/controllers/fonter/modals.min.js"
],
"fonter.goods":[
"scripts/controllers/fonter/goods.min.js",
"views/fonter/goods/modal.all.html"
],
"fonter.courses":["scripts/controllers/fonter/courses.min.js"],
"fonter.member":[
"scripts/controllers/fonter/member.min.js",
"views/fonter/member/modal.all.html"
],
"fonter.sign":[
"scripts/controllers/fonter/sign.min.js",
"views/fonter/sign/modal.all.html"
],
"fonter.accountGather":["scripts/controllers/fonter/accountGather.min.js"],
"fonter.bracelet":["scripts/controllers/fonter/bracelet.min.js"],
"fonter.deposit":["scripts/controllers/fonter/deposit.min.js"],
"fonter.reserve":["scripts/controllers/fonter/reserve.min.js"],
"finance.home":[
"scripts/controllers/finance/home.min.js",
"views/finance/home/modal.all.html"
],
"finance.member":[
"scripts/controllers/finance/member.min.js",
"views/finance/member/modal.all.html"
],
"finance.bill":[
"scripts/controllers/finance/bill.min.js",
"views/finance/bill/modal.all.html"
],
"chainFinance.member":[
"scripts/controllers/chainFinance/member.min.js",
"views/chainFinance/member/modal.all.html"
],
"chainFinance.bill":[
"scripts/controllers/chainFinance/bill.min.js",
"views/chainFinance/bill/modal.all.html"
],
"chainFinance.home":["scripts/controllers/chainFinance/home.min.js"],
"fonter.accountLog":[
"scripts/controllers/fonter/accountLog.min.js",
"views/fonter/accountLog/modal.all.html"
],
"admin.shopInfos":[
"scripts/controllers/admin/shopInfos.min.js",
"views/admin/shopInfos/modal.all.html"
]
}
//获取设备列表
window.MEDIA_DEVICE_INOFS = [];
navigator.mediaDevices.enumerateDevices().then(function(d) {
var a = _.where(d,{kind:'videoinput'});
_.each(a,function(t,i){
var o = {text:t.label || '摄像头 ' + (i + 1),value:t.deviceId}
window.MEDIA_DEVICE_INOFS.push(o);
});
}).catch(function(error){console.log('navigator.getUserMedia error: ', error);});

})();
35 changes: 32 additions & 3 deletions recipes/webpack.babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,48 @@
"author": "Shane Osbourne",
"license": "MIT",
"scripts": {
"start": "node app"
"dev": "node app",
"build": "webpack"
},
"dependencies": {},
"devDependencies": {
"angular": "^1.6.4",
"angular-animate": "^1.6.4",
"angular-base64": "^2.0.5",
"angular-bootstrap": "^0.12.2",
"angular-mask": "^1.4.0",
"angular-md5": "^0.1.10",
"angular-sanitize": "^1.6.4",
"angular-ui-router": "^1.0.3",
"angular-ui-utils": "^0.1.1",
"angularjs-toaster": "^2.1.0",
"babel-core": "^6.1.2",
"babel-loader": "^6.1.0",
"babel-plugin-transform-runtime": "^6.1.2",
"babel-preset-es2015": "^6.1.2",
"babel-preset-stage-0": "^6.1.2",
"bootstrap": "^3.3.7",
"browser-sync": "^2.8.0",
"bs-fullscreen-message": "^1.0.0",
"css-loader": "^0.28.4",
"favicons-webpack-plugin": "^0.0.7",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.28.0",
"jquery": "^2.2.4",
"moment": "^2.18.1",
"ngstorage": "^0.3.11",
"node-sass": "^4.5.3",
"oclazyload": "^1.1.0",
"pug": "^2.0.0-rc.2",
"pug-loader": "^2.3.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.6",
"socket.io-client": "^2.0.3",
"strip-ansi": "^3.0.0",
"webpack": "^1.10.5",
"webpack-dev-middleware": "^1.2.0"
"style-loader": "^0.18.2",
"underscore": "^1.8.3",
"url-loader": "^0.5.9",
"webpack": "^2.4.1",
"webpack-dev-middleware": "^1.10.2"
}
}
7 changes: 0 additions & 7 deletions recipes/webpack.babel/src/actions.js

This file was deleted.

16 changes: 16 additions & 0 deletions recipes/webpack.babel/src/index.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
doctype html
html(lang="en-US")
head
title 美加美·健身·PC
meta(charset="utf-8")
meta(http-equiv="Expires" content="0")
meta(http-equiv="Pragma" content="no-cache")
meta(http-equiv="Cache-control" content="no-cache")
meta(http-equiv="Cache" content="no-cache")
meta(name="apple-mobile-web-app-capable" content="yes")
meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1")
body
h1 Browsersync, Webpack + Babel Example1112
span#number 1
button#inc(type="button") Increase
button#dec(type="button") Decrease
55 changes: 32 additions & 23 deletions recipes/webpack.babel/src/main.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
import { inc, dec } from './actions';

window.onload = function() {
let number = document.getElementById('number');
let incBtn = document.getElementById('inc');
let decBtn = document.getElementById('dec');

incBtn.addEventListener(
'click',
function() {
number.innerHTML = inc(+number.innerHTML);
},
false
);

decBtn.addEventListener(
'click',
function() {
number.innerHTML = dec(+number.innerHTML);
},
false
);
};
import '../sass/bootstrap.scss';
import '../sass/bootstrap-theme.scss';
import '../bower_components/animate.css/animate.css';
import '../bower_components/angularjs-toaster/toaster.min.css';
import '../includes/index.css';
import '../bower_components/webrtc-adapter/release/adapter_no_edge.js';
import _ from 'underscore';
import 'bootstrap';
import angular from 'angular';
import 'angular-animate';
import 'angular-bootstrap';
import 'angular-md5';
import 'angular-sanitize';
import 'angular-ui-router';
import 'ngstorage';
import 'angularjs-toaster';
import 'oclazyload';
import 'angular-base64';
import 'moment';
import '../bower_components/angular-mask/dist/ngMask.js';
import '../bower_components/angular-ui-utils/ui-utils.js'
import '../bower_components/printThis/printThis.js';
import '../bower_components/laydate/laydate.js';
import '../bower_components/laydate/need/laydate.css';
import '../bower_components/laydate/skins/default/laydate.css';
import '../bower_components/ngmodel-format/src/ngmodel.format.js';
import '../bower_components/moment/moment-locales.js';
import '../bower_components/moment/moment-precise-range.js';
//let template = require('../views/access/login.pug');
//let locals = { /* ... */ };
//let html = template(locals);
//console.log(template(locals));
23 changes: 23 additions & 0 deletions recipes/webpack.babel/src/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(function() {
console.log("this is test.js in src ");
let root = this;
//let previousUnderscore = root._;
console.log("this",this);
let _ = function(){

}
if (typeof exports !== 'undefined') {
if(typeof module !== 'undefined' && module.exports){
exports = module.exports = _;
}
exports._ = _;
} else {
root._ = _;
}
_.VERSION = '1.8.3';
if (typeof define === 'function' && define.amd) {
define('underscore', [], function() {
return _;
});
}
}.call(this));
4 changes: 4 additions & 0 deletions recipes/webpack.babel/views/access/login.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#page_login
.m-l-xxl.xs-m-l-md
p 123
include ../includes/components.pug
1 change: 1 addition & 0 deletions recipes/webpack.babel/views/includes/components.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
p 4567
Loading