- ๐ซ How to reach me: [email protected] or Linkedin
tuanthanh2067 / cv-ssg Goto Github PK
View Code? Open in Web Editor NEWStatic site generator
License: MIT License
Static site generator
License: MIT License
You're doing a good job of printing an error message when something goes wrong, for example: https://github.com/tuanthanh2067/cv-ssg/blob/main/bin/cv-ssg.js#L40. However, I would consider exiting the program and giving an error code for the process as well:
if (err) {
console.log(chalk.yellow(`Can not open ${file}`));
return process.exit(1);
}
You should always "crash"/exit a program when it gets into a state that it can't continue, and give an indication to the OS that it has failed (using 1 or another non-zero exit code).
Your .gitignore
file is specifying absolute paths to the root (e.g., /node_modules
), and you should give the name of the dirs as relative paths:
node_modules
.env
dist
test
test.txt
I would be careful adding test
to this, though, since we'll be adding tests later and you might wonder why you can't include them!
Hi Dustin, I would like to add a new option -c
or --config
to your repo. This allows users to specify a config file storing options' values.
By doing so, a user could run the SSG in 2 ways:
#1:
ssg --input ./site --output ./build --stylesheet https://cdn.jsdelivr.net/npm/water.css@2/out/water.css --lang fr
#2:
ssg --config ./ssg-config.json
ssg-config.json content:
{ "input": "./site", "output": "./build", "stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css", "lang": "fr" }
#Tasks:
I'm thinking about adding static images which will be stored in an assets
folder. This only works when user indicates it in .json
file and provide the path for assets
folder
This will only works on .md
files
Json file example
{
"input": "./site",
"stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css",
"assets": "./assets"
}
Steps
assets
folder under dist
folderHi Thanh, I would like to add a new feature for you tool, which is to support Markdown extension.
I'm going to implement the following:
Let me know if you have any requests for the feature.
Instead of using argument variables, try using actual options which can make the work easier.
Over here, you need to check all the arg variables through if conditions which makes the process lengthy, error prone and time consuming. I suggest you to try using options instead which would make has pros on the above mentioned points and is much easier to use! There are many npm frameworks like commander and yargs which can do that. Follow this link which leads to use options through commander package.
Hope this helps
Exit program with 0
if there's no errors, otherwise 1
You have code for using a 'default'
stylesheet. The README shows it being used once, but doesn't explain how it works. People won't know to use the word default
unless you explain it.
I'd also suggest that the README needs to be expanded to include more details and examples of how to use the various options and flags.
The file can be found under bin/helpers/readPath.js
readPath
file may return path, extension (which is currently called target) and results from reading that pathreadFile.js
should only read file, not convert md to html
const folder = `${process.cwd()}/dist`;
Instead of building paths with strings, use path.join()
Not sure why it can not read a folder containing files.
Code blocks inside markdown files should be coverted to <code></code>
in html
You are using chalk to add colour to the log output. I think you can improve it by using different colours when things work (e.g., green) vs. fail (e.g., yellow or red). Consider this code:
console.log(chalk.yellow("Convert to html successfully"));
} catch (err) {
console.log(chalk.yellow("Can not convert file"));
In both cases you use yellow.
Hi tuanthanh2067!
I am interested in your project and I would like to add support for Markdown (.md files) in it.
If users inputs a text file, nothing will change. If a Markdown file is used as input, only the header one syntax feature will be converted into HTML.
If you would like this feature please assign me this issue and reply to let me know. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.