GithubHelp home page GithubHelp logo

concat's Introduction

Concat

Build Status

Concatenate multiple files

Usage

Usage: concat [options]

concatenate multiple files

Options:
    -h, --help                   output usage information
    -V, --version                output the version number
    -o, --output <file>          output file

examples:

concat -o output.css ./1.css ./2.css ./3.css

You can also use it from node:

const concat = require('concat');

concat([file1, file2, file3]).then(result => console.log(result))

// or
concat([file1, file2, file3], outputFile)

Tests

To run tests you simply need to do:

npm run test

Like it?

โญ this repo

License

MIT

Copyright (c) 2017 Konstantin Gorodinskiy

concat's People

Contributors

gko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

concat's Issues

concat not working with dynamic values

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);

await second method

how are we expected to await using this api method?

concat([file1, file2, file3], outputFile)

suggestion: detect location of node_modules

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?

"The syntax of the command is incorrect" error

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"
}

Concat files in directory

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.

assets

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?

No option for delimiter

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.

Promise resolves before file is finished writing

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.') )

Add folder support.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.