Just put up a site
CC0-1.0 License
Upsite lets you start a local server without any configuration.
npx upsite
That’s it. Your website is up on HTTP and HTTPs. Need a trusted certificate?
npx upsite --trust
That’s it. Your HTTPs certificate is trusted and you won’t need to run this command again. Need a custom port?
npx upsite --port 8080
That’s it. Your website is up on HTTP and HTTPs at port 8080. Need Babel, PostCSS, or pHTML?
npx upsite --config standard
That’s it. HTML, CSS, and JS files in the public directory are automatically transformed. Need to change that directory?
npx update --dir whatever
That’s it. Your files are served from the whatever directory. Need your own rules?
npx update --config whatever
That’s it. You control the configuration from whatever.config.js.
module.exports = {
dir: 'www',
uses: [
// use js/jsx files with babel
{
extensions: ['js', 'jsx'],
require: {
babel: '@babel/core'
},
config: {
plugins: [
['@babel/plugin-transform-react-jsx', {
pragma: '$',
pragmaFrag: '$',
useBuiltIns: true
}]
]
},
// transform jsx files with babel
write: (use, stats, opts) => use.require.babel.transformAsync(
stats.source,
{
...use.config,
babelrc: false,
filename: stats.pathname
}
).then(
result => result.code
)
},
// use svg files with svgo
{
extensions: ['svg'],
require: {
svgo: 'svgo'
},
// use package.json[svgo], .svgorc, .svgorc.json, .svgorc.yaml, .svgorc.yml, .svgorc.js, svgo.config.js
config: (use) => use.readConfig('svgo'),
// transform svg files with svgo
write: (use, stats) => new use.require.svgo().optimize(
stats.source,
{
...use.config,
path: stats.filepath
}
).then(
result => result.data
)
}
]
};
Upsite automatically spins up a server and lets you start writing to files.
The server includes a self-signed SSL certificate which can be trusted. Upsite
creates a package.json
file and a public
folder with HTML, CSS, and JS
files inside of it to get you started, but these can be changed as well.