@@ -33,6 +33,64 @@ if (process.env.OUTPUT_PATH) {
3333 OUTPUT_PATH = join ( rootDir , '/dist' )
3434}
3535
36+ const patterns = [
37+ { from : 'styles' , to : 'css' } ,
38+ { from : 'assets/data' , to : 'assets/data' } ,
39+ { from : 'assets/img' , to : 'assets/img' } ,
40+ {
41+ from : './src/components/federal-agencies/html' ,
42+ to : 'src/components/federal-agencies/html'
43+ } ,
44+ {
45+ from : 'img/**/*' ,
46+ to : 'styles/uswds/' ,
47+ context : path . resolve ( rootDir , 'node_modules' , 'uswds' , 'dist' )
48+ } ,
49+ {
50+ from : './src/components/about-codedotgov/html' ,
51+ to : join ( OUTPUT_PATH , '/src/components/about-codedotgov/html' )
52+ } ,
53+ {
54+ from : './src/components/federal-agencies/html' ,
55+ to : join ( OUTPUT_PATH , '/src/components/federal-agencies/html' )
56+ } ,
57+ {
58+ from : 'fonts/**/*' ,
59+ to : 'uswds/' ,
60+ context : path . resolve ( rootDir , 'node_modules' , 'uswds' , 'dist' )
61+ } ,
62+ {
63+ from : 'fonts/*' ,
64+ to : 'uswds/' ,
65+ context : path . resolve ( rootDir , 'assets' )
66+ } ,
67+ {
68+ from : 'fonts/*' ,
69+ to : 'assets/' ,
70+ context : path . resolve ( rootDir , 'assets' )
71+ } ,
72+ {
73+ from : './404.html' ,
74+ to : join ( OUTPUT_PATH , '404.html' )
75+ } ,
76+ {
77+ from : 'node_modules/@webcomponents/custom-elements/custom-elements.min.js' ,
78+ to : 'polyfills/custom-elements.js'
79+ } ,
80+ {
81+ from : 'node_modules/custom-event-polyfill/polyfill.js' ,
82+ to : 'polyfills/custom-event.js'
83+ } ,
84+ {
85+ from : 'node_modules/whatwg-fetch/dist/fetch.umd.js' ,
86+ to : 'polyfills/fetch.js'
87+ } ,
88+ {
89+ from : 'node_modules/url-search-params-polyfill/index.js' ,
90+ to : 'polyfills/url-search-params.js'
91+ }
92+ ]
93+
3694if ( BRANCH . includes ( 'production' ) ) {
3795 // only include sitemap if building for production on code.gov
3896 patterns . push ( {
@@ -57,65 +115,7 @@ module.exports = {
57115 SITE_CONFIG : JSON . stringify ( SITE_CONFIG )
58116 } ) ,
59117 new EnvironmentPlugin ( [ 'CODE_GOV_API_BASE' , 'CODE_GOV_API_KEY' , 'CODE_GOV_TASKS_URL' ] ) ,
60- new CopyPlugin ( {
61- patterns : [
62- { from : 'styles' , to : 'css' } ,
63- { from : 'assets/data' , to : 'assets/data' } ,
64- { from : 'assets/img' , to : 'assets/img' } ,
65- {
66- from : './src/components/federal-agencies/html' ,
67- to : 'src/components/federal-agencies/html'
68- } ,
69- {
70- from : 'img/**/*' ,
71- to : 'styles/uswds/' ,
72- context : path . resolve ( rootDir , 'node_modules' , 'uswds' , 'dist' )
73- } ,
74- {
75- from : './src/components/about-codedotgov/html' ,
76- to : join ( OUTPUT_PATH , '/src/components/about-codedotgov/html' )
77- } ,
78- {
79- from : './src/components/federal-agencies/html' ,
80- to : join ( OUTPUT_PATH , '/src/components/federal-agencies/html' )
81- } ,
82- {
83- from : 'fonts/**/*' ,
84- to : 'uswds/' ,
85- context : path . resolve ( rootDir , 'node_modules' , 'uswds' , 'dist' )
86- } ,
87- {
88- from : 'fonts/*' ,
89- to : 'uswds/' ,
90- context : path . resolve ( rootDir , 'assets' )
91- } ,
92- {
93- from : 'fonts/*' ,
94- to : 'assets/' ,
95- context : path . resolve ( rootDir , 'assets' )
96- } ,
97- {
98- from : './404.html' ,
99- to : join ( OUTPUT_PATH , '404.html' )
100- } ,
101- {
102- from : 'node_modules/@webcomponents/custom-elements/custom-elements.min.js' ,
103- to : 'polyfills/custom-elements.js'
104- } ,
105- {
106- from : 'node_modules/custom-event-polyfill/polyfill.js' ,
107- to : 'polyfills/custom-event.js'
108- } ,
109- {
110- from : 'node_modules/whatwg-fetch/dist/fetch.umd.js' ,
111- to : 'polyfills/fetch.js'
112- } ,
113- {
114- from : 'node_modules/url-search-params-polyfill/index.js' ,
115- to : 'polyfills/url-search-params.js'
116- }
117- ]
118- } ) ,
118+ new CopyPlugin ( { patterns } ) ,
119119 new ImageminPlugin ( { test : / \. ( j p e ? g | p n g | g i f | s v g ) $ / i } ) ,
120120 new HtmlWebpackPlugin ( {
121121 hash : true ,
0 commit comments