gko / concat Goto Github PK
View Code? Open in Web Editor NEW๐ฑ concatenate files
License: MIT License
๐ฑ concatenate files
License: MIT License
Hi, please change it so that the concat Promise doesn't resolve until the file saving is finished. When I load the combined file after then() is called, it sporadically causes an error because the file is not there yet. This package therefore cannot be used to reliable read the file after concatenation.
Tested on Mac in a Node Webpack build pipeline.
concat( [ part1.js, part2.js' ], combined.js ).then( resolve('While the combined result is available here in variable result, combined.js is not always finished being saved to disk.') )
Using this within a node application, I hit a case where I wanted to concatenate multiple files together without inserting a linebreak between them (it's for reassembling a single piece of data spread across files). Currently the newline is hard-coded. I fixed it in my local build by hacking the change into the package, but maybe it would be worthwhile including an option to either omit the \n
or take it a step further by allowing the user to supply a delimiter string, much like the join method on an array. Obviously this would be an optional parameter with the default behavior being identical to current behavior.
To be clear, I don't mind doing the work and submitting a PR if I've got agreement on the change.
Is it possible to concat all files in a directory?
Let's say I have a folder with 20 js files, I want to concat all of them but listing it individually in an npm script is rather tedious.
I tried "my_modules/js/*.js" which doesn't work - but it would be awesome if it did. In this case it would get all the files with .js extension in that folder.
Hey
im new using this library and i have one issue
When i generate the concat file, it ignores de assets build folder and some of the functionalities are lost
can you help me how to avoid this lost?
I get a "The syntax of the command is incorrect". any ideas what i am doing wrong?
[email protected] concat:js C:\wamp64\www\wordpress\wp-content\plugins\wpshout-react-quiz
> mkdir -p dist/js && concat -o dist/js/scripts.js 1.js 2.js
The syntax of the command is incorrect.
{
"name": "wpshout-react-quiz",
"version": "1.0.0",
"description": "",
"main": "wpshout-react-quiz.js",
"dependencies": {
"concat": "^1.0.3",
"npm-run-all": "^4.1.2",
"onchange": "^3.3.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-image-lightbox": "^4.5.0",
"react-slick": "^0.19.0",
"uglify": "^0.1.5",
"watch": "^1.0.2"
},
"devDependencies": {},
"scripts": {
"concat:js": "mkdir -p dist/js && concat -o dist/js/scripts.js 1.js 2.js",
"concat": "npm run concat:js",
"uglify": "uglifyjs -o dist/js/scripts.min.js dist/js/scripts.js",
"build:js": "npm run concat:js && npm run uglify",
"build": "npm run build:js",
"watch": "watch 'npm run build' node_modules/react/umd/ node_modules/react-dom/umd/ node_modules/react-slick/lib/mixins/ node_modules/react-slick/lib/utils/ node_modules/react-slick/lib/ node_modules/react-slick/dist/"
},
"author": "",
"license": "ISC"
}
Sometimes I use concat to build my javascript project. And sometimes my projects use some modules from NPM. So I think it would be a good idea to detect the location from node_modules using require.resolve()
.
So instead of
concat ./node_modules/.../...js ./index.js
we could do
concat npm_module_name ./index.js
What do you think?
Hi,
Could you add support for folders ex:
concat -o output.css ./folder
It would make the package.json CLI scripts lines cleaner / easier to maintain.
how are we expected to await using this api method?
concat([file1, file2, file3], outputFile)
Hi. I have an issue I would like to resolve. When I explicitly use a string:
concat([..], "path/to/destinatin");
..then the concat works. But when I:
let path = "path/to/destinatin";
concat([..], path);
..then the concat does not work. What am I possibly doing wrong?
Variations that do not work either:
let path = String("path/to/destinatin");
concat([..], path);
let path = "path/to/destinatin".toString();
concat([..], path);
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.