my project structure is similar with this:
dist
- *
node_modules
- *
source
- *.js
- *.spec.js
- *.test.js
- *.vue
- __tests__
tests
- *.js
- *.spec.js
- *.test.js
I try create a glob for get only code files vue and js, but I unknown like retire spec and test files in source directory.
My current glob is: project/!(node_modules|dist|__tests__|tests)**/*.+(!(spec|test)|vue|js)
This get all files inside source this, ignoring __tests__ folder. How I can ignore *.spec.js and *.test.js files too?
This is a late answer, but maybe someone will profit from it:
project/!(node_modules|dist|__tests__|tests)**/(!(*.spec|*.test)|.vue|.js)
The magical part is this one: /**/!(*.test).js, where you ignore all files containing .test.js and importing all other .js files.
Related
I have a project that uses translation so the file structure looks like 'assets/translations/*'. The node module that I am using also uses the same file structure so when rollup copy the files and puts it to '/dist/assets/' it first copies the one from node_modules then the one from my project. The problem is that it overwrites the translations from node_module and causes issue with the component from that package.
The end result that I need is for both translations (en.js) file to merge in the dist folder so both the node_module and my package can refer to its values.
Tried merge and copy from rollup but no luck or I was using it wrong. Any help is appreciated.
Maybe the title is a bit strange, but I can't seem to find anything about on google.
Question: I have a folder that only contains .ts files and .json files.. Typescript compiles the .ts files and puts it into a separate directory (not as a bundle, just the directory structure 'as-is').
Src /
Workers /
[ModuleA.ts, ModuleA.json],
[ModuleB.ts, ModuleB.json],
[MobuleC.ts, ModuleC.json]
Most of the time I can just require('*.json') and the JSON file will be also placed in to build directory.
But now I have a situation, where importing the JSON will make no sense, because the JSON file gets updated every few seconds and I read the file with fs.readFile('*.json'), so I also don't want it floating around in the v8 cache (through require)
So how do I 'include' a JSON/None-Typescript file into the build, that is not explicitly being importing by either require or import?
For now I just used gulp to copy every .json file in the src folder over to the the respective dist/** folder.
But still find it strange typescript doesn't have something included for it..
Maybe you should checkout --resolveJsonModule, it's a newer feature of typescript.
I am new to gulp.
I have a directory in /src which I want to move to /dist.
My directory looks like this with a depth of more than 1.
folder1
- folder2
-folder4
-folder5
-folder6
-folder7
-folder8
-folder10
-folder9
- folder3
I have declared src path as /src/folder1/* in gulp file and it has moved only folder1,folder2,folder3 to the destination path.folder2 and folder3 are empty folders which is perfectly fine.
I have declared src path as /src/folder/** in gulp file and it has moved all the folders as expected to the destination path.And while I was going through all the folders in destination path after running gulpfile, it crashed with segmentation11.What is the reason for this?
And what is the actual method to move all the folders of above structure in gulp?
This is the behavior of node-glob which gulp uses under the hood. From their readme:
* Matches 0 or more characters in a single path portion
..
** If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It does
not crawl symlinked directories.
* will match everything in the same directory.
** will match everything recursively (subdirectories).
The segmentation fault is most likely due to a flaw in your script.
All my projects contains alot of files with the same name 'file1.php file1.less file1.css file1.min.js file1.js file1.json'
Is there a plugin or a way to group all those files with same basename under eg. file1.php, just like the filewatchers does it.
The grouping relations can only be established when running watchers, so using watchers is the right way to go. It can indeed be a batch script that does nothing - this is the 'Output paths to refresh' option that matters: it should provide a pattern for files that has to be nested. For example, let you have same-named files with .php, .css and .js extensions in some folder, and like to nest the latter 2 in .php file (doesn't make much sense, but it's just an example).
create a .bat/sh file that does nothing (echos some string, etc.)
create a new custom file watcher, set 'php' as file type, your .bat - as a program
specify $FileName$ and $FileDir$ as 'Arguments' and 'Working directory' respectively
set $FileNameWithoutExtension$.css:$FileNameWithoutExtension$.js as 'Output paths to refresh'
Now when you modify your phpfile watcher will be run and nest .js and .css in .php
Currently it is not possible to perform such nesting/grouping manually (excluding File Watchers).. and I personally know no plugin that can do this.
Watch these tickets (star/vote/comment) to get notified on progress:
https://youtrack.jetbrains.com/issue/IDEA-113347
https://youtrack.jetbrains.com/issue/WEB-7635
In my gassetic.yml file I have the following
files:
app.css: # This is the output filename
- src/someBundle/app.scss
However when gassetic runs, I get an error saying src/someBundle/app_0.scss is missing.
If I create this file and edit it, its this app_0.scss that is compiled.
Why does gassetic / gulp look for this file when its not specified in my yml file?
Thanks
It adds index of the file in the folder to avoid overwritting.
I think this is a bug but you can fix it by adding autoRenaming: false to the dev environment. See Multiple Environments setup