Add a base-url flag to the build command
This commit is contained in:
parent
f26b9d53bd
commit
73797efe90
|
@ -22,6 +22,7 @@
|
||||||
- Defaults to compressed Sass output
|
- Defaults to compressed Sass output
|
||||||
- Fix regression wrt co-located assets slug detecting
|
- Fix regression wrt co-located assets slug detecting
|
||||||
- Rename `url` from page front-matter to `path` to be consistent
|
- Rename `url` from page front-matter to `path` to be consistent
|
||||||
|
- Add a `base-url` flag to the `build` command to override the URL from config.toml
|
||||||
|
|
||||||
## 0.1.3 (2017-08-31)
|
## 0.1.3 (2017-08-31)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,12 @@ This will build the whole site in the `public` directory.
|
||||||
$ gutenberg build
|
$ gutenberg build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can override the config `base_url` by passing a new URL to the `base-url` flag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gutenberg build --base-url https://59a896e2cf321c2dcfd2d6de--tera.netlify.com/
|
||||||
|
```
|
||||||
|
|
||||||
## serve
|
## serve
|
||||||
|
|
||||||
This will build and serve the site using a local server. You can also specify
|
This will build and serve the site using a local server. You can also specify
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub fn build_cli() -> App<'static, 'static> {
|
||||||
)
|
)
|
||||||
(@subcommand build =>
|
(@subcommand build =>
|
||||||
(about: "Builds the site")
|
(about: "Builds the site")
|
||||||
|
(@arg base_url: -u --base-url +takes_value "Force the base URL to be that value (default to the one in config.toml)")
|
||||||
)
|
)
|
||||||
(@subcommand serve =>
|
(@subcommand serve =>
|
||||||
(about: "Serve the site. Rebuild and reload on change automatically")
|
(about: "Serve the site. Rebuild and reload on change automatically")
|
||||||
|
|
|
@ -5,8 +5,11 @@ use site::Site;
|
||||||
|
|
||||||
use console;
|
use console;
|
||||||
|
|
||||||
pub fn build(config_file: &str) -> Result<()> {
|
pub fn build(config_file: &str, base_url: Option<&str>) -> Result<()> {
|
||||||
let mut site = Site::new(env::current_dir().unwrap(), config_file)?;
|
let mut site = Site::new(env::current_dir().unwrap(), config_file)?;
|
||||||
|
if let Some(b) = base_url {
|
||||||
|
site.config.base_url = b.to_string();
|
||||||
|
}
|
||||||
site.load()?;
|
site.load()?;
|
||||||
console::notify_site_size(&site);
|
console::notify_site_size(&site);
|
||||||
console::warn_about_ignored_pages(&site);
|
console::warn_about_ignored_pages(&site);
|
||||||
|
|
|
@ -40,10 +40,10 @@ fn main() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
("build", Some(_)) => {
|
("build", Some(matches)) => {
|
||||||
console::info("Building site...");
|
console::info("Building site...");
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
match cmd::build(config_file) {
|
match cmd::build(config_file, matches.value_of("base_url")) {
|
||||||
Ok(()) => console::report_elapsed_time(start),
|
Ok(()) => console::report_elapsed_time(start),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
console::unravel_errors("Failed to build the site", &e);
|
console::unravel_errors("Failed to build the site", &e);
|
||||||
|
|
Loading…
Reference in a new issue