File tree Expand file tree Collapse file tree 2 files changed +98
-2
lines changed Expand file tree Collapse file tree 2 files changed +98
-2
lines changed Original file line number Diff line number Diff line change 2323 "scripts" : {
2424 "dev" : " encore dev" ,
2525 "serve" : " encore dev-server --port 9000" ,
26- "build" : " encore production"
26+ "build:style" : " lessc less/scroller.less dist/scroller.css" ,
27+ "build:module" : " rollup -c" ,
28+ "build" : " yarn run build:module && yarn run build:style"
2729 },
2830 "engines" : {},
2931 "main" : " js/scroller.js" ,
3436 "devDependencies" : {
3537 "@symfony/webpack-encore" : " ^0.23.0" ,
3638 "less" : " ^3.9.0" ,
37- "less-loader" : " ^4.1.0"
39+ "less-loader" : " ^4.1.0" ,
40+ "rollup" : " ^1.1.2" ,
41+ "rollup-plugin-babel" : " ^4.3.2" ,
42+ "rollup-plugin-commonjs" : " ^9.2.0" ,
43+ "rollup-plugin-node-resolve" : " ^4.0.0" ,
44+ "rollup-plugin-uglify" : " ^6.0.2"
3845 }
3946}
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of the Fxp package.
3+ *
4+ * (c) François Pluchino <[email protected] > 5+ *
6+ * For the full copyright and license information, please view the LICENSE
7+ * file that was distributed with this source code.
8+ */
9+
10+ import babel from 'rollup-plugin-babel' ;
11+ import commonjs from 'rollup-plugin-commonjs' ;
12+ import resolve from 'rollup-plugin-node-resolve' ;
13+ import { uglify } from 'rollup-plugin-uglify' ;
14+
15+ const baseConfig = {
16+ input : 'js/scroller.js' ,
17+ external : [
18+ 'jquery'
19+ ] ,
20+ plugins : [
21+ resolve ( ) ,
22+ commonjs ( {
23+ include : 'node_modules/@fxp/jquery-pluginify/**'
24+ } ) ,
25+ babel ( {
26+ presets : [
27+ '@babel/preset-env'
28+ ]
29+ } )
30+ ]
31+ } ;
32+
33+ const iifeConfig = {
34+ ...baseConfig ,
35+ output : {
36+ format : 'iife' ,
37+ name : 'FxpScroller' ,
38+ exports : 'named' ,
39+ globals : {
40+ jquery : 'jQuery'
41+ }
42+ }
43+ } ;
44+
45+ const uglifyConfig = {
46+ compress : {
47+ pure_getters : true ,
48+ unsafe : true ,
49+ unsafe_comps : true ,
50+ warnings : false
51+ }
52+ } ;
53+
54+ export default [
55+ {
56+ ...iifeConfig ,
57+ output : {
58+ ...iifeConfig . output ,
59+ file : 'dist/scroller.js'
60+ }
61+ } ,
62+ {
63+ ...iifeConfig ,
64+ plugins : [ ...baseConfig . plugins , uglify ( uglifyConfig ) ] ,
65+ output : {
66+ ...iifeConfig . output ,
67+ file : 'dist/scroller.min.js'
68+ }
69+ } ,
70+ {
71+ ...iifeConfig ,
72+ input : 'js/sticky-header.js' ,
73+ output : {
74+ ...iifeConfig . output ,
75+ name : 'FxpStickyHeader' ,
76+ file : 'dist/sticky-header.js'
77+ }
78+ } ,
79+ {
80+ ...iifeConfig ,
81+ input : 'js/sticky-header.js' ,
82+ plugins : [ ...baseConfig . plugins , uglify ( uglifyConfig ) ] ,
83+ output : {
84+ ...iifeConfig . output ,
85+ name : 'FxpStickyHeader' ,
86+ file : 'dist/sticky-header.min.js'
87+ }
88+ }
89+ ] ;
You can’t perform that action at this time.
0 commit comments