Git Product home page Git Product logo

laravel-mix-make-file-hash's People

Contributors

alexfroese avatar ben-rogerson avatar chiiya avatar dependabot-preview[bot] avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

laravel-mix-make-file-hash's Issues

Return promise or use synchronous operations

jsonFile.readFile and jsonFile.writeFile are asynchronous operations. I want to do some additional stuff after the manifest.json file has been updated. Either a promise should be returned upon completion or failure, or the synchronous methods should be used.

Run Before Plugin Apply

I am using this package to make file names with hash.
but the problem is i want to upload files to S3 Server but your plugin runs after webpackconfig plugins!

here is my plugin apply method:

apply(compiler) {
        compiler.plugin('after-emit', (compilation, cb) => {
            this.validateOptions(compilation, cb)
            this.getAssets(compilation)
                .then(files => this.filterAllowedAssets(files))
                .then(files => this.uploadAssets(files))
                .then(() => this.filterAllowedDirectories())
                .then(directories => this.uploadDirectories(directories))
                .then(() => cb())
                .catch(e => this.handleErrors(e, compilation, cb));
        });
    }

Deleting stale hashed files

Hi Ben!

Thanks for creating this, I needed a replacement for laravel-mix-versionhash. Gonna check out your Agency set up soon.

I'm not able to delete the stale hashed files with force set to true in delOptions. Here's the output with debug turned on:

Manifest found: '../web/dist/mix-manifest.json'
Renamed '../web/dist/js/app.js' to '../web/dist/js/app.b1e46e01a3c3a84c3cd6.js' (delOptions '{"force":true}')
Renamed '../web/dist/css/app.css' to '../web/dist/css/app.36b4410866e3e76ee304.css' (delOptions '{"force":true}')
Finished updating '../web/dist/mix-manifest.json' with the new filenames:
 {
  '/js/app.js': '/js/app.b1e46e01a3c3a84c3cd6.js',
  '/css/app.css': '/css/app.36b4410866e3e76ee304.css'
}

The built files from previous runs are still there. Not a biggie but I'd like to nuke them.

The invocation:

if (mix.inProduction()) {
  mix.version();
  mix.then(() => {
    convertToFileHash({
      publicPath: '../web/dist',
      manifestFilePath: '../web/dist/mix-manifest.json',
      delOptions: { force: true },
      debug: true
    });
  });
}

Here are the versions I'm using:

  "devDependencies": {
    "laravel-mix": "^6.0.11",
    "laravel-mix-make-file-hash": "^2.2.0",
    "laravel-mix-purgecss": "^6.0.0",
    "postcss": "^8.2.4",
    "resolve-url-loader": "^3.1.2",
    "sass": "^1.32.5",
    "sass-loader": "^8.0.2"
  }

Please advise. Thanks!

Disable renaming for certain extensions

USE CASE: I want to rename only JS, CSS and image files, specifically not HTML files. I can create a pull request to add an option for this, unless you know of a better way to handle this use case directly in Laravel Mix?

can't make it hash the image files

I'm kind of new to Laravel Mix, but I think doing all accrodingly to the docs, all files inside of /images folder has plain names, w\o\ hash being applied to them.

MY Mix config:

const convertToFileHash = require("laravel-mix-make-file-hash");

mix.setPublicPath('resources/dist');

mix.version().then(() => {
    
    convertToFileHash({
        publicPath: "resources/dist",
        manifestFilePath: "resources/dist/mix-manifest.json"
    });
});

HAs is successfully being added to CSS and JS files, and these changes also reflected in manifest json file. But I can't seem to make images work the same way. Please, advice!

Generate sass/css doesn't use hash filenames

When setting the resource root

i.e.
mix.setResourceRoot('public/assets');

The generate scss files do not use the hash for a respective image file.

The generated image filename:
2ndpg-hdr.0153009dd5cf3cc09e63.jpg

The resulting css style:
.someDiv { background-image: url(/public/assets/2ndpg-hdr.jpg?09845228d6032d2361194d24968b0c5c); }

As a result, images aren't displayed correctly

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.