I need a Glob pattern to match all files in api/db/seeds/ folder or the README.md, this one is at the root of the project. I came up with the following pattern {**/seeds/*,README.md}, but it isn't working. Do you have any ideas?
Related
I'm trying exclude paths in Pug, that should not be among compiled files in dist folder, but nothig help!.
I renamed dir parts to _parts, parts/footer.pug to _parts/_footer.pug, but I still see compiled files in dist/_parts/ dir.
So, how can exclude some paths in Pug. (I use pug-cli as compiler)?
Yes it's possible with bash
And if you're on Windows, you can use git bash
You just need to prefix the ignored file with "_"
So, suppose your project directory looks like this:-
my-project/
index.html
pugjs
_head.pug
index.pug
you can do:-
pug -w "$(ls ./pugjs/!(_*))" -o ./
Now what does this line do?
basically, the "$(ls ./pugjs/!(*))" lists all files that don't have the prefix ""
they get passed as files paths argument to pug
I know this question will get so many downvotes and will be marked as a duplicate.
The problem is I searched a lot about that question and never got a satisfying answer.
When working with sources in HTML and we want to get an image from the same folder of the HTML file we type the image name directly. If it's inside a folder which is in the same place as the HTML file is, we type the folder name then image, and so on....
If the image is in a folder which contains another folder in which the HTML file exists, so we want to get one step back. We type ../ which means go one step back then the image name.
When I started learning node and how to use modules, modules which were in the same folder as the node file is, must be imported using ./ which was explained as 'in the same folder', while when we import modules like 'fs' and 'events' they don't need a ./
Can someone explain why we don't use ./ in html files while they are used sometimes in node and sometimes no?!
I want to explain it because the node default import setting.
like 'fs' and 'events', these library was installed with node installed, and was included by default. And these will be stored in system directory. Just like <stdio.h> for c, fs from python. It's the default library for the corresponding language.
But sometimes you write you own libraries wanted to be import by other node file, you should import it by using relative path...Because if you don't write './', it will default search the system file directory where is stored 'fs', 'http' and so on, node will not find your libraries.
Before we start ./ and ../ notation is used to refer files relatively.
Why we sometimes don't use ./ in node?
All the modules we install in NodeJS are in the folder node modules. Whenever you require a module require('fs') or require('3rdparty'). Node exactly knows where to look for the module as it is installed as a folder in local node_modules or global node_modules. And then it loads the index.js and then so on..
When to use ./ in node?
./ is a way(Relative way) to refer files in the file system. If you have a script which is part of the file system and not as part of a node_module, then you use './' or '../' notation based on your file location
Why we don't use ./ in HTML files?
As said by #sami, you can use either ./ or not. It works in both ways. I am accustomed to ./ when I work. It's more of personal opinion.
Hope this helps.
I have a website:
www.mydomain.com/panel/abcde.html
I don't remember the difference between ./ and ../
./ is used to return in the first level?
Instead ../ is used to simulate all domain?
.../ exists?
I believe it is like this :
/ = root of the currently location
./ = current directory
../ = parent of current directory
Reference could be found here
/ is the root folder of the filesystem.
./ usually denotes the current folder that your program or script is in, usually the same one with the file you run.
../ denotes the folder above the current one.
.../ Does not exist. If you type that on terminal, it will throw error No such file or directory
I'm having trouble getting mysql commands to work because, for some reason, it can't find the directory to the mysql files even though the path listed is correct.
Here is what I get when I enter $PATH:
-bash: /Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/mysql/bin: No such file or directory
However, I can CD into that path, and the files are listed there. How come they cannot be found?
Thanks
This is my project structure:
main
-/data/data.json
-/a/b/c.py
main.py
data folder an a folder are in main folder which is the root of my project.
I need to read data.json from c.py in python3
what would be my string in open()?
file = open('./data/data.json')
this works in windows but not linux
Up two folders and then in data/data.json:
with open('../../data/data.json') as f:
...
If you are on Windows, swap slashes with backslashes.