Skip to content

A starter project for using Framework7 with Webpack via Babel!

License

Notifications You must be signed in to change notification settings

workplus-templates/webpack-framework7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webpack-framework7

A starter project for using Framework7 with Webpack via Babel!

技术栈

  • Framework7
  • Less
  • ES6
  • Cordova
  • Webpack
  • Babel
  • Polyglot

安装

确保已经安装workplus-cli

$ npm install workplus-cli -g

然后执行以下命令:

$ workplus start webpack-framework7 my-project

安装完成后,进入项目目录,执行npm install

开发

a. 开发模式

$ npm run dev

默认端口为8080,可通过配置package.jso文件的scripts属性来修改端口。

b. 设置代理

在webpack.config.js中设置devServer,大概配置如下:

var config = {
  ...
  devServer: {
    proxy: {
      '/api': {
        target: 'http://api.example.com'
      }
    }
  }
}

切记:若使用该代理,访问接口应该为相对路径,既接口为http://some.example.com/topics,应写成/topics

c. 发布

$ npm run build

代码将会打包到dist文件夹,可以使用workplus进入dist文件夹并启动server进行测试。

警告

在安卓的workplus下,此段代码会报错,请直接注释掉:12811行-12821行

// OS classes
// if (device.os) {
//     classNames.push(device.os, device.os + '-' + device.osVersion.split('.')[0], device.os + '-' + device.osVersion.replace(/\./g, '-'));
//     if (device.os === 'ios') {
//         var major = parseInt(device.osVersion.split('.')[0], 10);
//         for (var i = major - 1; i >= 6; i--) {
//             classNames.push('ios-gt-' + i);
//         }
//     }

// }

Author

Hejx

About

A starter project for using Framework7 with Webpack via Babel!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published