diff --git a/docs/guides/guide.md b/docs/guides/guide.md index 69c0c0ccb..99f1b77a0 100644 --- a/docs/guides/guide.md +++ b/docs/guides/guide.md @@ -346,6 +346,11 @@ When prompted, enter the name of the application created when you set up the Fir node_modules/.bin/firebase login ``` +Update your index.stache to change the production steal path: + +@sourceref guides/guide/steps/16-cdn/index.stache +@highlight 36 + Then we can deploy the application by running: ``` @@ -446,98 +451,3 @@ The Windows application can be opened with In this guide we created a small chat application that connects to a remote API with DoneJS. It has routing between two pages and can send and receive messages in real-time. We built an optimized bundle for production and deployed it to a static file host and CDN. Last, we made builds of the application as a mobile and desktop application. If you want to learn more about DoneJS - like how to create more complex custom elements and routes, write and automatically run tests, Continuous Integration and Continuous Deployment - head over to the [place-my-order Guide](./place-my-order.html). - -## IE8 Support - -This section is optional. Follow it only if you're interested in making applications that are compatible with IE8. - -### Support CORS - -Since our application uses cross domain requests we need to make a couple of changes to make it work in IE8 which doesn't support CORS. The first is to create a [jQuery prefilter](http://api.jquery.com/jquery.ajaxprefilter/) so all HTTP requests are marked as being cross domain. Create `src/prefilter.js`: - -```js -import $ from "jquery"; - -$.ajaxPrefilter(function(options){ - options.crossDomain = true; -}); -``` - -Next we need to install [jQuery transport](http://api.jquery.com/jquery.ajaxtransport/) that will perform our cross domain requests in IE8: - -``` -npm install jquery-transport-xdr --save -``` - -Finally import both of these modules in your messages model. Change `src/models/message.js` to: - -```js -import can from 'can'; -import superMap from 'can-connect/can/super-map/'; -import tag from 'can-connect/can/tag/'; -import 'can/map/define/define'; -import io from 'steal-socket.io'; -import 'jquery-transport-xdr'; -import 'donejs-chat/prefilter'; - -export const Message = can.Map.extend({ - define: {} -}); - -Message.List = can.List.extend({ - Map: Message -}, {}); - -export const messageConnection = superMap({ - url: 'http://chat.donejs.com/api/messages', - idProp: 'id', - Map: Message, - List: Message.List, - name: 'message' -}); - -tag('message-model', messageConnection); - -const socket = io('http://chat.donejs.com'); - -socket.on('messages created', - order => messageConnection.createInstance(order)); -socket.on('messages updated', - order => messageConnection.updateInstance(order)); -socket.on('messages removed', - order => messageConnection.destroyInstance(order)); - -export default Message; -``` -@highlight 6,7 - -### Install jQuery 1.x - -DoneJS comes with jQuery 2.x by default, but if you need to support IE8 the 1.x branch is necessary. You can switch by installing the right version: - -``` -npm install jquery@1.11.0 --save -``` - -Update your `build.js` file to make the compiled output work in IE: - -```js -var buildPromise = stealTools.build({ - config: __dirname + "/package.json!npm", - babelOptions: { - loose: "es6.modules" - } -}, { - bundleAssets: true -}); -... -``` -@highlight 2-5 - -And rebuild: - -``` -donejs build -``` - -The application will now work in IE8. diff --git a/guides/guide/steps/16-cdn/deploy.json b/guides/guide/steps/16-cdn/deploy.json deleted file mode 100644 index 536784b71..000000000 --- a/guides/guide/steps/16-cdn/deploy.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "donejs": { - "deploy": { - "root": "dist", - "services": { - "production": { - "type": "firebase", - "config": { - "firebase": "", - "public": "./dist", - "headers": [{ - "source": "/**", - "headers": [{ - "key": "Access-Control-Allow-Origin", - "value": "*" - }] - }] - } - } - } - } - } -} diff --git a/guides/guide/steps/16-cdn/index.stache b/guides/guide/steps/16-cdn/index.stache new file mode 100644 index 000000000..691085ef6 --- /dev/null +++ b/guides/guide/steps/16-cdn/index.stache @@ -0,0 +1,43 @@ + + + {{title}} + + + + + + +
+
+
+ {{#eq page 'chat'}} + + {{#if isPending}} + Loading... + {{else}} + + {{/if}} + + {{else}} + + {{#if isPending}} + Loading... + {{else}} + + {{/if}} + + {{/eq}} +
+
+
+ + {{#switch env.NODE_ENV}} + {{#case "production"}} + + {{/case}} + {{#default}} + + {{/default}} + {{/switch}} + +