Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lenadax committed Nov 4, 2024
1 parent b49441a commit 91b338a
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 75 deletions.
13 changes: 8 additions & 5 deletions js/rollup.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ window.yafowil.location = exports;
`;

export default args => {
let conf = [];

////////////////////////////////////////////////////////////////////////////
// DEFAULT
Expand Down Expand Up @@ -50,9 +51,9 @@ export default args => {
});
}
let scss_default = {
input: ['scss/default/styles.scss'],
input: ['scss/default/widget.scss'],
output: [{
file: `${out_dir}/default/widget.css`,
file: `${out_dir}/default/widget.min.css`,
format: 'es',
plugins: [terser()],
}],
Expand All @@ -66,6 +67,7 @@ export default args => {
}),
],
};
conf.push(bundle_default, scss_default);

////////////////////////////////////////////////////////////////////////////
// BOOTSTRAP5
Expand Down Expand Up @@ -106,9 +108,9 @@ export default args => {
});
}
let scss_bs5 = {
input: ['scss/bootstrap5/styles.scss'],
input: ['scss/bootstrap5/widget.scss'],
output: [{
file: `${out_dir}/bootstrap5/widget.css`,
file: `${out_dir}/bootstrap5/widget.min.css`,
format: 'es',
plugins: [terser()],
}],
Expand All @@ -122,6 +124,7 @@ export default args => {
}),
],
};
conf.push(bundle_bs5, scss_bs5);

return [bundle_default, scss_default, bundle_bs5, scss_bs5];
return conf;
};
File renamed without changes.
File renamed without changes.
106 changes: 50 additions & 56 deletions src/yafowil/widget/location/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,66 @@


##############################################################################
# Default
# Leaflet
##############################################################################

# webresource ################################################################

resources = wr.ResourceGroup(
name='yafowil.widget.location',
directory=resources_dir,
path='yafowil-location'
)
resources.add(wr.ScriptResource(
leaflet_js = wr.ScriptResource(
name='leaflet-js',
directory=os.path.join(resources_dir, 'leaflet'),
path='yafowil-location/leaflet',
resource='leaflet-src.js',
compressed='leaflet.js'
))
resources.add(wr.ScriptResource(
)
leaflet_css = wr.StyleResource(
name='leaflet-css',
directory=os.path.join(resources_dir, 'leaflet'),
path='yafowil-location/leaflet',
resource='leaflet.css'
)
leaflet_geosearch_js = wr.ScriptResource(
name='leaflet-geosearch-js',
depends='leaflet-js',
directory=os.path.join(resources_dir, 'leaflet-geosearch'),
path='yafowil-location/leaflet-geosearch',
resource='geosearch.umd.js'
))
resources.add(wr.ScriptResource(
name='yafowil-location-js',
depends=['jquery-js', 'leaflet-geosearch-js'],
resource='default/widget.js',
compressed='default/widget.min.js'
))
resources.add(wr.StyleResource(
name='leaflet-css',
directory=os.path.join(resources_dir, 'leaflet'),
path='yafowil-location/leaflet',
resource='leaflet.css'
))
resources.add(wr.StyleResource(
)
leaflet_geosearch_css = wr.StyleResource(
name='leaflet-geosearch-css',
depends='leaflet-css',
directory=os.path.join(resources_dir, 'leaflet-geosearch'),
path='yafowil-location/leaflet-geosearch',
resource='geosearch.css'
)

##############################################################################
# Default
##############################################################################

# webresource ################################################################

resources = wr.ResourceGroup(
name='yafowil.widget.location',
directory=resources_dir,
path='yafowil-location'
)
resources.add(leaflet_js)
resources.add(leaflet_css)
resources.add(leaflet_geosearch_js)
resources.add(leaflet_geosearch_css)
resources.add(wr.ScriptResource(
name='yafowil-location-js',
directory=os.path.join(resources_dir, 'default'),
depends=['jquery-js', 'leaflet-geosearch-js'],
resource='widget.js',
compressed='widget.min.js'
))
resources.add(wr.StyleResource(
name='yafowil-location-css',
directory=os.path.join(resources_dir, 'default'),
depends='leaflet-geosearch-css',
resource='default/widget.css'
resource='widget.min.css'
))

# B/C resources ##############################################################
Expand Down Expand Up @@ -82,7 +95,7 @@
'order': 21,
}, {
'group': 'yafowil.widget.location.common',
'resource': 'default/widget.css',
'resource': 'default/widget.min.css',
'order': 22,
}]

Expand All @@ -98,45 +111,26 @@
directory=resources_dir,
path='yafowil-location'
)
bootstrap5_resources.add(wr.ScriptResource(
name='leaflet-js',
directory=os.path.join(resources_dir, 'leaflet'),
path='yafowil-location/leaflet',
resource='leaflet-src.js',
compressed='leaflet.js'
))
bootstrap5_resources.add(wr.ScriptResource(
name='leaflet-geosearch-js',
depends='leaflet-js',
directory=os.path.join(resources_dir, 'leaflet-geosearch'),
path='yafowil-location/leaflet-geosearch',
resource='geosearch.umd.js'
))
bootstrap5_resources.add(leaflet_js)
bootstrap5_resources.add(leaflet_css)
bootstrap5_resources.add(leaflet_geosearch_js)
bootstrap5_resources.add(leaflet_geosearch_css)
bootstrap5_resources.add(wr.ScriptResource(
name='yafowil-location-js',
directory=os.path.join(resources_dir, 'bootstrap5'),
depends=['jquery-js', 'leaflet-geosearch-js'],
resource='bootstrap5/widget.js',
compressed='bootstrap5/widget.min.js'
))
bootstrap5_resources.add(wr.StyleResource(
name='leaflet-css',
directory=os.path.join(resources_dir, 'leaflet'),
path='yafowil-location/leaflet',
resource='leaflet.css'
))
bootstrap5_resources.add(wr.StyleResource(
name='leaflet-geosearch-css',
depends='leaflet-css',
directory=os.path.join(resources_dir, 'leaflet-geosearch'),
path='yafowil-location/leaflet-geosearch',
resource='geosearch.css'
resource='widget.js',
compressed='widget.min.js'
))
bootstrap5_resources.add(wr.StyleResource(
name='yafowil-location-css',
directory=os.path.join(resources_dir, 'bootstrap5'),
depends='leaflet-geosearch-css',
resource='bootstrap5/widget.css'
resource='widget.min.css'
))

# B/C resources ##############################################################

bootstrap5_js = [{
'group': 'yafowil.widget.location.dependencies',
'resource': 'leaflet/leaflet.js',
Expand All @@ -160,7 +154,7 @@
'order': 21,
}, {
'group': 'yafowil.widget.location.common',
'resource': 'bootstrap5/widget.css',
'resource': 'bootstrap5/widget.min.css',
'order': 22,
}]

Expand Down
10 changes: 0 additions & 10 deletions src/yafowil/widget/location/resources/bootstrap5/styles.css

This file was deleted.

8 changes: 4 additions & 4 deletions src/yafowil/widget/location/tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ def test_resources(self):
self.assertEqual(scripts[1].file_name, 'geosearch.umd.js')
self.assertTrue(os.path.exists(scripts[1].file_path))

self.assertTrue(scripts[2].directory.endswith(np('/location/resources')))
self.assertTrue(scripts[2].directory.endswith(np('/location/resources/default')))
self.assertEqual(scripts[2].path, 'yafowil-location')
self.assertEqual(scripts[2].file_name, 'default/widget.min.js')
self.assertEqual(scripts[2].file_name, 'widget.min.js')
self.assertTrue(os.path.exists(scripts[2].file_path))

styles = resources.styles
Expand All @@ -337,9 +337,9 @@ def test_resources(self):
self.assertEqual(styles[1].file_name, 'geosearch.css')
self.assertTrue(os.path.exists(styles[1].file_path))

self.assertTrue(styles[2].directory.endswith(np('/location/resources')))
self.assertTrue(styles[2].directory.endswith(np('/location/resources/default')))
self.assertEqual(styles[2].path, 'yafowil-location')
self.assertEqual(styles[2].file_name, 'default/widget.css')
self.assertEqual(styles[2].file_name, 'widget.min.css')
self.assertTrue(os.path.exists(styles[2].file_path))


Expand Down

0 comments on commit 91b338a

Please sign in to comment.