Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

miniapp-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miniapp-loader

Mini Program single-file component loader for Webpack

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

miniprogram-loader

Mini Program single-file component loader for Webpack

Install

npm install miniprogram-loader --save-dev

Usage (e.g wechat)

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.kico$/,
        loader: 'miniprogram-loader',
        options: {
          htmlExt: 'wxml',
          cssExt: 'wxss',
          jsExt: 'js'
        }
      }
    ]
  }
}

single-file component

<template lang="pug">
  view.container
    view.userinfo
      button(wx:if="{{!hasUserInfo}}" open-type="getUserInfo") 获取头像昵称
      block(wx:else)
        text.userinfo-nickname {{userInfo.nickName}}
    view.usermotto
      text.user-motto {{motto}}
</template>

<script>
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
})

</script>
<style lang="scss">
.userinfo {
  display: flex;
  flex-direction: column;
  align-items: center;
  h2 {
    background: red;
  }
}
</style>

Keywords

FAQs

Package last updated on 27 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc