Skip to content

Commit

Permalink
needed to move the loading of the USWDS javascript to the body of the…
Browse files Browse the repository at this point in the history
… page. Made some other minor updates including introducing minification of the javascript and updating the autoprefixer config.
  • Loading branch information
mbucknell committed Mar 31, 2021
1 parent f91192b commit f03a108
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ specified on the --load-path option along with the uswds/src/stylesheets when th
the style sheets the css should also be processed by postcss using the autoprefixer and postcss-csso using a postcss.config.js file:
```javascript
const autoprefixerOptions = [
'>2%',
'> 2%',
'Last 2 versions',
'IE 11'
'IE 11',
'not dead'
];

module.exports = ctx => ({
Expand Down
61 changes: 58 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"src"
],
"dependencies": {
"uswds": "2.10.1"
"uswds": "2.11.1"
},
"devDependencies": {
"@rollup/plugin-buble": "^0.21.3",
Expand All @@ -75,6 +75,7 @@
"postcss-csso": "^5.0.0",
"postcss-flexbugs-fixes": "^5.0.2",
"rollup": "^2.44.0",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.32.8",
"stylelint": "^13.12.0",
"stylelint-config-recommended-scss": "^4.2.0",
Expand Down
5 changes: 3 additions & 2 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const autoprefixerOptions = [
'>2%',
'> 2%',
'Last 2 versions',
'IE 11'
'IE 11',
'not dead'
];

module.exports = ctx => ({
Expand Down
10 changes: 9 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@
const buble = require('@rollup/plugin-buble');
const commonjs = require('@rollup/plugin-commonjs');
const resolve = require('@rollup/plugin-node-resolve');
const {terser} = require('rollup-plugin-terser');

const bubleConfig = require('./buble.config');

const pkg = require('./package.json');

const env = process.env.NODE_ENV || 'development';

module.exports = {
input: 'src/js/main.js',
plugins: [
resolve.nodeResolve({
mainFields: ['module']
}),
commonjs(),
buble(bubleConfig)
buble(bubleConfig),
env === 'production' && terser({
compress: {
drop_console: true
}
})
],
output: [{
file: pkg.main,
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<script src="uswds-init.min.js"></script>
<link rel="stylesheet" href="wdfnviz.css">
<script src="wdfnviz.js"></script>
<title>Test Page - USGS Water Data For The Nation</title>
</head>
<body>
<script async src="wdfnviz.js"></script>
{% macro url_for(path) %}{{ path }}{% endmacro %}
{% include "templates/header.html" %}
<main>
Expand Down

0 comments on commit f03a108

Please sign in to comment.