Code Monkey home page Code Monkey logo

Comments (4)

rckatz avatar rckatz commented on May 17, 2024 1

index.js:

import MyResume from './assets/sam-poe-resume.pdf';
...
function addResume(MyResume){
  const elements = document.getElementsByClassName('.cta-btn--resume');
  for(let el of elements){
    el.href = url(MyResume);
  }
}initSr();
initTilt();
addResume();

webpack.common.js:

module: {
    rules: [
      {
        test: /\.html$/,
        use: ['html-loader']
      },
      {
        test: /\.(jpg|jpeg|png|gif|svg|pdf)$/,
        use: [
          {
            loader: 'file-loader',
            options: {
              name: '[name].[ext]', //removed [hash]
              outputPath: 'assets'
            },
          },
        ],
      },
    ],
  },

from simplefolio.

cobiwave avatar cobiwave commented on May 17, 2024

Hello @rckatz, I think you're getting problems because webpack doesn't know about PDF files. I'll check if I can solve that issue on the webpack config. Thank you for notice that issue, I'll let you know once I resolve this issue.

from simplefolio.

rckatz avatar rckatz commented on May 17, 2024

@cobidev,
How I eventually got it to work was adding an import line in the index.js file so it could "see" the PDF, added a function to add that link to the resume button href, and removed the [hash] from the file-loader, name line in the webpack.common file. (was something like [name][hash].[ext]) file-loader had PDF listed but it wasn't picking it up in the asset folder for whatever reason.

from simplefolio.

frankoadeleye avatar frankoadeleye commented on May 17, 2024

Very helpful. Thanks

from simplefolio.

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.