Luismahou / grunt-hashres

Hashes your js and css files and rename the <script> and <link> declarations that refer to them in your html/php/etc files.
MIT License
115 stars 41 forks source link

Unable to rename files - no such file or directory #24

Closed matoni555 closed 10 years ago

matoni555 commented 10 years ago

When I specify option renameFiles to true, I get warning with unable to rename files. File specified in dest is replaced correctly.

Paths are correct. My project is in directory C:\web\www\myproject.cz and CSS file is here C:\web\www\myproject.cz\www\frontend\dist\css\style.css

I'm using Windows 8 64bit.

Config:

hashres: {
    options: {
        encoding: 'utf8',
        fileNameFormat: '${name}.${ext}?${hash}',
        renameFiles: true
    },
    dist: {
        src: [
            'www/frontend/dist/css/style.css',
            'www/frontend/dist/js/script.js',
            'www/frontend/dist/js/scriptHeader.js'
        ],
        dest: 'app/FrontModule/templates/@layout.latte',
    }
}

Output from console:

Running tasks: hashres

Running "hashres" task

Running "hashres:dist" (hashres) task
Verifying property hashres.dist exists in config...OK
Files: www/frontend/dist/css/style.css, www/frontend/dist/js/script.js, www/frontend/dist/js/scriptHeader.js -> app/FrontModule/templates/@layout.latte
Options: fileNameFormat="${name}.${ext}?${hash}", encoding="utf8", renameFiles
Verifying property hashres.dist.src exists in config...OK
Verifying property hashres.dist.dest exists in config...OK
Warning: ENOENT, no such file or directory 'C:\web\www\myproject.cz\www\frontend\dist\css\style.css' Use --force to continue.

Aborted due to warnings.

Thanks

Luismahou commented 10 years ago

Which versions of nodejs, grunt and grunt-hashres are you using?

Are your css and js renamed?

matoni555 commented 10 years ago

renameFiles is set to true, but fileNameFormat is set to '${name}.${ext}?${hash}', so it no need to rename, it adds only hash.