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

beef

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beef

beef - brwoser end equals framework

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

beef -- 牛排

解决前后端模块化共用;面向前端AMDJS模块,支持前端模块在服务端使用;提供模块插件机制;支持自定义路由

beef means that modules from backend to frontend stay works

Features

  • 支持标准模块加载器, requirejs, esl, seajs
  • 支持常用插件形式, text, json, less, css
  • 支持自定义扩展插件 require.plugin
  • 支持自定义路由配置

  global.require = require('beef');
  
  // 自定义路由
  require.config({
      baseUrl: './source',
      packages: {
          'admin': '../admin'
      }
  });
  
  // 自定义扩展插件
  require.plugin.ext = function (filename) {
      return require(filename);
  };

支持多模块配置

  • v0.0.7开始
    // 配置第一次
    require.config({
        name: 'source',
        baseUrl: './source',
        packages: {
            'resource': './resource'
        }
    });

    // 配置第二次
    require.config({
        name: 'admin',
        baseUrl: './admin',
        packages: {
            'public': './public'
        }
    });

使用方法

使用npm安装beef

npm install beef


// 如果不仅仅当前模块使用,建议暴露为全局对象
global.require = require('beef');

// 同步require 方式
var mod = require('./mod');

// 异步调用方式
require(['./amd'], function(amd) {
    console.log(amd);
});

// 利用插件读取
var text = require('text!./text.txt');

console.log(text);

模块写法

  • 采用AMDJS写法

需要用define-function定义模块

define(function(require, exports, module) {
    return "mod";
});
  • 采用node_modules写法
module.exports = {
  name: 'node-module'
};

fresh beef

Keywords

FAQs

Package last updated on 02 Apr 2014

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