定制 lin3s/lin3s-distribution 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lin3s/lin3s-distribution

最新稳定版本:v4.3.2

Composer 安装命令:

composer require lin3s/lin3s-distribution

包简介

Distribution library for different purposes inside LIN3S

README 文档

README

Distribution library for different purposes inside LIN3S.

Latest Stable Version

Downloads from packagist (PHP):
Downloads from Packagist

Downloads from NPM (JS):
Downloads from NPM

Why?

In LIN3S, we are working with many libraries and projects and usually all of them need scripts to automate some process. This library centralize this kind of scripts and tasks improving its reusability.

Installation

At this moment, this package contains PHP and JavaScript code, so you can manage this library from NPM and from Composer.

If your project is in PHP, be sure that Composer is installed in your system and execute the following command:

$ composer require lin3s/distribution

Otherwise, if your project is in JavaScript, be sure that Node is installed in your system and execute the following command:

$ npm install lin3s-distribution --save-dev
#
# OR
#
$ yarn add lin3s-distribution --dev

Usage

The following code is the basic configuration to make it work with Webpack.

'use strict';

const Webpack = require('lin3s-distribution').Webpack;

const options = {
  entry: {
    'app': './app/Resources/assets/js/entry-app.js',
  },
  input: {
    base: 'app',
    scss: 'app/Resources/scss',
    includedNodeModules: [
      'swiper'
    ]
  },
  output: {
    jsPath: './web',
    jsPublicPath: '/',
    jsFilename: '[name].js',
    jsFilenameProduction: '[name].[chunkhash].js',

    cssPath: '',
    cssPublicPath: '/',
    cssFilename: '[name].css',
    cssFilenameProduction: '[name].[contenthash].css'
  },
  postcss: {
    autoprefixer: {
      browsers: ['last 2 versions']
    }
  },
  manifest: '../../manifest.json'
};

module.exports = Webpack(options);

Symfony integration

Firstly, you need to install the bundle in your app kernel.

// app/config/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...

        new LIN3S\Distribution\Php\Symfony\Lin3sDistributionBundle(),
        // ...
    ];
}

Once the bundle has been enabled you can manage the configuration. The following is the default config:

# app/config/config.yml

lin3s_distribution:
    webpack:
        manifest_path: "%kernel.root_dir%/../manifest.json"
        public_js_path: "/js/"
        public_css_path: "/css/"

Optionally you can enable the webpack default configuration doing this:

# app/config/config.yml

lin3s_distribution:
    webpack: ~

Finally replace your script and link html tags with the following Twig tags.

{# app/Resources/views/base.html.twig #}

(...)

<head>
(...)

    {% webpack_entry_css 'app' %}
</head>

<body>
(...)

    {% webpack_entry_js 'app' %}
</body>

Licensing Options

License

统计信息

  • 总下载量: 5.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-24