lin3s / distribution
Distribution library for different purposes inside LIN3S
Installs: 17 247
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Language:JavaScript
Requires
- fullpipe/twig-webpack-extension: ^2.0.0
- symfony/filesystem: ^2.3 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^1.12
Suggests
- symfony/framework-bundle: Allows to integrate the distribution with Symfony
- dev-master
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.0
- v4.0.1
- v4.0.0
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.0
This package is not auto-updated.
Last update: 2024-11-09 20:17:46 UTC
README
Distribution library for different purposes inside LIN3S.
Downloads from packagist (PHP):
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>