Vuepress: How can I switch config.js depending deploy target? - vuepress

How can I switch config.js depending on the target?
For example, in case deploy to localhost, I'd set dest: parameter in config.js as public:
dest: 'public/docs'
or, as dist for netlify
dest: 'dist/docs'

I've found solution with vuepress 1.x as --dest option, like as follows:
vuepress build --dest dist/docs docs
The docs is created on dist folder even config.js specifies as dest: 'public/docs',

Related

Gitlab CI Pass Variable to Included Workflow

I have a worklow which uses a workflow from another project
include:
- project: {project repo}
ref: {branch name}
file: parent.gitlab-ci.yml
Is there a way to pass a variable to that, similar to how you would pass values to a Github Action? For Example...
include:
- project: {project repo}
ref: {branch name}
file: parent.gitlab-ci.yml
Var1: Foo
Var2: Bar
Thanks,
When a workflow is included, variables are essentially shared with the included workflow. See more here.

Best way to import sass / code from GitHub?

I'm trying to figure out how Hugo can (automatically) pull the most recent files from a Github folder when running hugo server. In particular, I like to pull css files from Primer CSS by GitHub. What is the best way to implement that, so that I do not always have to update the Primer CSS manually on my Git?
I was thinking modules would be a way (config.yaml):
module:
imports:
- disable: false
path: github.com/primer/css
mounts:
- source: src/scss
target: assets/scss/primer
However, when adding this to config.yaml, it does not appear to work:
Error: module "github.com/primer/css" not found; either add it as a Hugo Module or store it in "/Users/user/code/my-theme/themes".: module does not exist
Is there any simple best practice in automatically pulling the most recent files from https://github.com/primer/css/(/src) and loading it into the /assets folder? Or is the only way to work with npm node modules, like here: https://github.com/lucperkins/hugo-primer
Thanks in advance!
I struggled with this for a long time. The key is to initialize your your site as a "go module" by running hugo mod init {anything}. That will create a go.mod file. So if you ran hugo mod init mywebsite that generate a go.mod that looks something like this:
module mywebsite
go 1.14
require github.com/primer/css v1.0.0 // indirect
After that, the modules should work for you.

How to extend private tslint that are stored in github repo?

I am trying to extend a custom github repo installed via:
// package.json
"my-custom-rule": "mikebarron/custom-rules#custom-branch"
how to apply this rule in extends?
extends: ["mikebarron/custom-rules"]
just giving "custom-rules" wont work.
Discovered the solution, looks like I needed to follow the "main" on "package.json" file, need to have "custom-rules" in this case.

YAML - Get contents of artifacts folder

I have an AWS S3 website, my yaml builds my site to a dist folder.
What I expect is for my website structure to look like this:
-root
index.html
etc...
Everything works fine, except my website structure ends up looking like this:
-root
-dist
index.html
etc...
This is what my artifacts section of my yaml looks like:
artifacts:
files:
- 'dist/**/*'
It seems, essentially, I do not want the dist folder to be my artifacts, I want the CONTENTS of the dist folder to be the artifacts.
It also seems that the flag to ignore paths flattens the entire system, which I do NOT want. I just want to ignore that one folder dist, and get its contents, including subfolders, etc.
Seems you need the 'base-directory' mapping:
Try this:
artifacts:
base-directory: dist
files:
- '**/*'

Yeoman Grunt Build ... Wrong Font Dir

Im really new to Yeoman, I just tried it yesterday and I'm not sure where to do some configurations.
My problem is that the minified vendor CSS (AKA Bootstrap) is trying to get the fonts from the ROOT of my server
my structure is like this:
Here are my production files
htdocs/laravel/public/dist
the fonts are located in
dist/fonts
BUT, if I look in the minified vendor css file, the fonts url is set to
/bower_components/bootstrap/dist/fonts/
which means is looking in the htdocs folder, and I know it this because I copied my assets in the htdocs and tn works...
How do I configure Grunt so the url points to the dist/fonts and Not to the root???
I've checked the Gruntfile.js and I can't find where is it
I came across the exact same problem yesterday.
I found out that this pull request is fixing the issue:
https://github.com/cebor/generator-angular/commit/c6d5ee67e108a0699f95c78702cb1939233226a8
What I did to fix it in my project was commenting out the following lines of code. According to the pull request this cssmin does nothing but replace relative paths by absolute paths.
// The following *-min tasks produce minified files in the dist folder
cssmin: {
options: {
root: '<%%= yeoman.app %>'
}
},
The a grunt build uses the correct path, which is "../fonts"

Resources