Prechádzať zdrojové kódy

Greatly improved example page and command for dev — `watch:example`

Artur Paikin 8 rokov pred
rodič
commit
044aa2d533
4 zmenil súbory, kde vykonal 28 pridanie a 14 odobranie
  1. 4 1
      .gitignore
  2. 7 8
      example/index.html
  3. 8 0
      example/main.js
  4. 9 5
      package.json

+ 4 - 1
.gitignore

@@ -14,7 +14,10 @@ website/public/
 website/.deploy*/
 website/src/_drafts
 website/themes/uppy/source/uppy/
-npm-debug.log*
 website/themes/uppy/_config.yml
+
+npm-debug.log*
 config/
 nohup.out
+
+example/bundle.js

+ 7 - 8
example/index.html

@@ -7,15 +7,14 @@
   <body>
     <h1>Uppy is here</h1>
     <button id="uppyModalOpener">Open Modal</button>
-    <link href="../dist/uppy.min.css" rel="stylesheet">
-    <script src="../dist/uppy.min.js"></script>
-    <script src="../dist/locales/ru_RU.js"></script>
+    <link href="uppy.min.css" rel="stylesheet">
+    <script src="bundle.js"></script>
     <script>
-      var uppy = new Uppy.Core({locales: Uppy.locales.ru_RU, debug: true})
-        .use(Uppy.plugins.Modal, {trigger: '#uppyModalOpener'})
-        .use(Uppy.plugins.Dashboard, {target: Uppy.plugins.Modal})
-        .use(Uppy.plugins.Dummy, {target: Uppy.plugins.Modal})
-        .run();
+      // var uppy = new Uppy.Core({locales: Uppy.locales.ru_RU, debug: true})
+      //   .use(Uppy.plugins.Modal, {trigger: '#uppyModalOpener'})
+      //   .use(Uppy.plugins.Dashboard, {target: Uppy.plugins.Modal})
+      //   .use(Uppy.plugins.Dummy, {target: Uppy.plugins.Modal})
+      //   .run();
     </script>
 
     <script>

+ 8 - 0
example/main.js

@@ -0,0 +1,8 @@
+const Uppy = require('../src/index.js')
+
+const uppy = new Uppy.Core({debug: true})
+  .use(Uppy.plugins.Modal, {trigger: '#uppyModalOpener'})
+  .use(Uppy.plugins.Dashboard, {target: Uppy.plugins.Modal})
+  .use(Uppy.plugins.Dummy, {target: Uppy.plugins.Modal})
+
+uppy.run()

+ 9 - 5
package.json

@@ -32,10 +32,13 @@
     "test:unit": "node test/unit/index.js | tap-spec",
     "test": "npm run lint && npm run test:unit",
     "travis:deletecache": "travis cache --delete",
-    "watch:css": "nodemon --watch src --ext scss -x 'npm run build:css && node website/update.js'",
-    "watch:fast": "npm-run-all --parallel watch:css web:preview",
-    "watch:js": "nodemon --watch src --ext js -x 'npm run build:bundle && node website/update.js'",
+    "watch:css": "nodemon --watch src --ext scss -x 'npm run build:css'",
+    "watch:js": "nodemon --watch src --ext js -x 'npm run build:bundle'",
     "watch": "npm-run-all --parallel watch:js watch:css",
+    "watch:fast": "npm-run-all --parallel watch:css web:preview",
+    "watch:example:browsersync": "browser-sync start --server 'example' --serveStatic 'dist' --files 'example/bundle.js, dist/uppy.min.css'",
+    "watch:example:js": "watchify -t ['babelify'] example/main.js -o example/bundle.js -vd",
+    "watch:example": "npm-run-all --parallel watch:example:js watch:css watch:example:browsersync",
     "web:build": "cd website && node update.js && ./node_modules/.bin/hexo generate --silent && node build-examples.js",
     "web:clean": "cd website && ./node_modules/.bin/hexo clean",
     "web:deploy": "npm-run-all web:install web:disc docs web:build && ./bin/web-deploy",
@@ -70,8 +73,9 @@
     "babel-preset-es2015-loose": "7.0.0",
     "babel-register": "6.7.2",
     "babelify": "7.2.0",
-    "browser-sync": "2.10.0",
-    "browserify": "12.0.1",
+    "browser-sync": "2.13.0",
+    "browserify": "13.0.1",
+    "watchify": "3.7.0",
     "chalk": "1.1.1",
     "cssnano": "3.6.2",
     "disc": "1.3.2",