Coder Social home page Coder Social logo

pjax-orm-cdn-manifest-lazyload's Introduction

  • v1.1 新增:优化静态资源分发器

CDN预加载

pjax

js 离线存储 loaclStorage

  • 将js文件保存在 loaclStorage 中
  • 离线缓存有个弊端,当有新版本时浏览器文件不更新

封装 ORM

  • 引入 localforage
  • 异步存储 IndexedDB (默认) 或 WebSQL
  • 不支持 IndexedDB 的浏览器,使用 localStorage

webpack插件 + 服务器 配置Mainefest

  • 当断网时、服务器断开时,也能访问页面
  • 地址 https://www.npmjs.com/package/webpack-manifest
  • 配置主要3个步骤
    • 1、在服务器上添加MIME TYPE
    • 2、创建 .manifest 文件,配置缓存的文件,并标注版本号
    • 3、给 标签加 manifest 属性,并引用manifest文件
      • <html manifest="path/to/name-of.manifest">
  • 后两个配置,可以添加webpack插件自动完成,打包时,会自动生成一个 cache.manifest 文件
    • 注意 Manifest 和 HtmlWebpackPlugin 的位置,前者要写在后者的后面

动态配置静态资源路径

  • output 设置 publicPath 属性
  • 有时在处理 html 和 css 中的路路径有冲突,比如同时使用了一张图片
    • 此时需要用插件来配置 html-withimg-loader 单独处理HTML中图片路径问题

优化静态资源分发器

  • 使静态资源加载的并发数最大化
  • 使用 lazyload 插件 路径 https://github.com/rgrove/lazyload/
    • 异步请求资源,可以放到 LocalStorage 中
    • 当请求时间最长的资源请求完毕,再按顺序执行文件
    • 怎么知道最耗时的请求是哪个,怎么按顺序执行?lazyload 插件帮我们做了

pjax-orm-cdn-manifest-lazyload's People

Contributors

flp511 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.