npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

egg-vue-webpack-spa-boilerplate

v4.0.0

Published

Egg Vue SSR/CSR 服务端/客户端渲染单页面工程骨架项目

Downloads

39

Readme

egg-vue-webpack-boilerplate

基于 Egg + Vue + Webpack 单页面服务端渲染(SSR)同构工程骨架项目

文档

  • https://github.com/easy-team
  • https://www.yuque.com/easy-team
  • https://zhuanlan.zhihu.com/easywebpack

1.特性

  • 基于 vue + vuex + vue-router + axios 单页面服务器客户端同构实现

  • 支持 server 和 client 端代码修改, webpack 时时编译和热更新, npm start 一键启动应用

  • 支持开发环境, 测试环境,正式环境 webpack 编译

2.依赖

3. 使用

3.1 安装cli(非必需)

npm install @easy-team/easywebpack-cli -g

3.2 安装依赖

npm install

3.3 启动应用

本地开发启动应用
npm run dev

应用访问: http://127.0.0.1:7001

npm start启动

发布模式启动应用
  • 首先在本地或者ci构建好jsbundle文件
npm run build 
  • 然后,启动应用
npm start 

4. 功能实现

4.1 单页面前端实现

在app/web/page 目录下面创建app目录, app.vue, app.js 文件.

  • app.vue 编写界面逻辑, 根元素为layout(自定义组件, 全局注册, 统一的html, meta, header, body)
<template>
  <app-layout>
    <transition name="fade" mode="out-in">
      <router-view></router-view>
    </transition>
  </app-layout>
</template>
<style lang="sass">

</style>
<script type="text/babel">
  export default {
    computed: {

    },
    mounted(){

    }
  }
</script>
  • app.js 页面调用入口
import { sync } from 'vuex-router-sync';
import store from 'store/app';
import router from 'component/app/router';
import app from './app.vue';
import App from 'app';
import Layout from 'component/layout/app';

App.component(Layout.name, Layout);

sync(store, router);

export default App.init({
  base: '/app',
  ...app,
  router,
  store
});

4.2 单页面后端实现

  • 创建controller文件app.js
exports.index = function* (ctx) {
  yield ctx.render('app/app.js', { url: this.url.replace(/\/app/, '') });
};
  • 添加路由配置
  app.get('/app(/.+)?', app.controller.app.app.index);

5. 打包部署

http://hubcarl.github.io/easywebpack/vue/build/

6. 实现原理

6.1 本地npm start启动流程

本地启动流程

6.2 服务端渲染页面访问流程

服务端渲染页面访问流程

6.3 详细资料

License

MIT