Git Product home page Git Product logo

Comments (2)

Rayhan545430 avatar Rayhan545430 commented on August 16, 2024

My html-loader is having issues with mustache. I added an option for images to have hash and also for videos to have hash in my webpack.common.js. The output for the videos and for the images is correct in the /dist folder - the hash is there, but my output code does not have the hash.

Here is my folder structure:

+--js
+--scss
+--img
+--video
|   index.mustache
|   about.mustache
|   work.mustache

And my webpack.common.js configuration:

const webpack = require('webpack');
const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const currentTask = process.env.npm_lifecycle_event;
const VueLoaderPlugin = require('vue-loader/lib/plugin');

module.exports = {
    
    entry: {
        main: './src/js/home.js',
        about: './src/js/about.js',
        work: './src/js/work.js',
    },

    module:{
        rules: [
            //rule for JS
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                use:'babel-loader'
            },
            //rule for html
            {
                test: /\.html$/i,
                loader: 'html-loader',
            },
            //rule for mustache files
            {
                test: /\.mustache$/,
                loader: 'mustache-loader',
                options: {
                    tiny: true,
                    render: {
                        title: 'hello Index',
                        subtitle: 'this is a subtitle',
                    },
                },
            } ,
            //Vue loader
            { 
                test: /\.vue$/, 
                use: 'vue-loader'
            },
           //rule for img 
           {
            test: /\.(png|svg|gif|jpg)$/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            name: "[name].[hash].[ext]",
                            outputPath: "img/",
                            publicPath: './img/'
                        }
                    },
                ],
            },
         // // rule for pdf files
            {
                test: /\.(pdf)$/,
                use: {
                    loader: 'file-loader',
                    options:{
                        name: '[name].[ext]',
                        outputPath: "files/",
                        publicPath: './files/'  
                    }
                },
            },

            // // Assets Loader
            {
                test: /\.(mp4|mov|avi|wmv|webm)$/,
                use: {
                    loader: 'file-loader',
                    options:{
                        name: '[name].[hash].[ext]',
                        outputPath: "video/",
                        publicPath: './video/'
                    }
                },
            },

            // Font Loader
            {
                test: /\.(woff|woff2|svg)$/,
                exclude: [path.resolve(__dirname, './src/img/')],
                use: {
                    loader: 'file-loader',
                    options:{
                        name: '[name].[ext]',
                        limit: 4096,
                        mimetype: "application/font-woff",
                        outputPath: 'css/fonts/',
                        publicPath: './css/fonts/',  
                    }
                },
            }

        ],
    },
    plugins:[
        new VueLoaderPlugin(),
        new HtmlWebpackPlugin({
            filename: './index.html',
            template: './src/index.mustache',
            inject: 'body',
            chunks: ['main'],
        }),
        new HtmlWebpackPlugin({
            filename: './about.html',
            template: './src/about.mustache',
            inject: 'body',
            chunks: ['about'],
        }),
        new HtmlWebpackPlugin({
            filename: './work.html',
            template: './src/work.mustache',
            inject: 'body',
            chunks: ['work']
        }),
    ],
    resolve: {
        alias: {
            '@scss': path.resolve(__dirname, 'src/scss'),
            '@img': path.resolve(__dirname, 'src/img'),
            '@': path.resolve(__dirname, 'src')
        }
    }
    
}

I don't want to remove the hashes from the images and videos, so I wonder what else can I do. Thank you!

from mustache.github.com.

jgonggrijp avatar jgonggrijp commented on August 16, 2024

This looks like a support request for mustache-loader. If still relevant and you have not already done so, please take it to https://github.com/deepsweet/mustache-loader/issues.

from mustache.github.com.

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.