Code Monkey home page Code Monkey logo

Comments (12)

vladshcherbin avatar vladshcherbin commented on May 30, 2024 1

@CPatchane I believe so, will check later this week, thank you

from rollup-plugin-copy.

vladshcherbin avatar vladshcherbin commented on May 30, 2024

I'd search for a plugin to change contents of a file so the workflow is this:

  • npm run dev
  • files copied to dist
  • plugin replaces contents in this dist index.html file

or another plugin to process index.html file separately

  • npm run dev
  • files copied to dist, but not index.html
  • index.html is processed with another plugin and saved in dist folder

May help:

https://www.npmjs.com/package/rollup-plugin-string-replacer
https://www.npmjs.com/package/rollup-plugin-replace-html-vars

What do think about this options?

Alternatively, in the next version a target object will have src, dist and rename properties. I can think about adding replace function with similar functionality if nothing else works 🤔

from rollup-plugin-copy.

frederikhors avatar frederikhors commented on May 30, 2024

@vladshcherbin I'm happy to see you answer right away.

My needs are fairly basic.

I could do all the operations with external cli, eliminating the use of rollup plugins.

But I saw that yours is great and I would like to expand it with these features which, I repeat, I consider basic for the development of a web application.

Now I'm using https://github.com/haifeng2013/rollup-plugin-bundle-html but as you can see in the issues there are a few problems.

In general it would be useful that in the development phase (without hash in file name) there is an index that is written (even only the first time) and that contains the .js and .css inject.

In the production phase obviously the bundles will have the hash in the name and therefore inject is with the hash.

I think your plugin needs to extend the functionality by adding this.

Thank you for your work.

from rollup-plugin-copy.

vladshcherbin avatar vladshcherbin commented on May 30, 2024

@frederikhors how about a transform option to give you contents or filename so you can use functions/packages to change it? Something like this:

copy({
  targets: [{
    src: 'src/index.html',
    dest: 'dist',
    transform: contents => contents.replace('%BundleNameVarFromRollup%', 'app.js')
  }]
})

from rollup-plugin-copy.

frederikhors avatar frederikhors commented on May 30, 2024

Yes, something like this.

I need to use src without hash in file name in development and hashes in production bundles.

from rollup-plugin-copy.

frederikhors avatar frederikhors commented on May 30, 2024

@vladshcherbin is it possible to get the hash of the file from rollup? Maybe choosing a final hook?

from rollup-plugin-copy.

vladshcherbin avatar vladshcherbin commented on May 30, 2024

@frederikhors using a separate plugin I believe, currently no tools for this in rollup-plugin-copy

from rollup-plugin-copy.

frederikhors avatar frederikhors commented on May 30, 2024

@vladshcherbin Closing this issue would make rollup-plugin-copy essential to any rollup project. The non-plus-ultra.

from rollup-plugin-copy.

JdesEva avatar JdesEva commented on May 30, 2024

Unable to copy file to destination folder
image

from rollup-plugin-copy.

JdesEva avatar JdesEva commented on May 30, 2024

Unable to copy file to destination folder
image

OK,I know.This must use an absolute path

from rollup-plugin-copy.

CPatchane avatar CPatchane commented on May 30, 2024

Is #31 fixing the issue here?

from rollup-plugin-copy.

vladshcherbin avatar vladshcherbin commented on May 30, 2024

Transform feature was released in 3.3.0 with the help of @CPatchane 🎉

from rollup-plugin-copy.

Related Issues (20)

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.