Using Grunt, I have installed and configured plugins : - grunt-contrib-copy - grunt-contrib-clean - grunt-contrib-concat - grunt-contrib-uglify - grunt-contrib-cssmin - grunt-usemin - grunt-contrib-imagemin - grunt-rev
In my architecture I have a index.html
in the root of public, a index.html
in a firstapp
folder within the public
and another index.html
inside the "secondapp" folder also within public
.
My images folder is in the root of public " public/images
" my CSS files are in public/css
, and the js
files are in public/js/lib
.
When running Grunt tasks , the index.html
that is in the root, where it points to the css files with the simple path: " css/---.css
", js
com files the paths " js/lib/---.js
" and an image with the path " images/---.jpg
". is correctly configured, it creates the file " raiz.bundle.min.css
" inside the css
, versiona folder and inserts it into the HTML page correctly, creates the file " raiz.bundle.min.js
" inside the js
, versiona folder and also inserts it on the page HTML correctly, compresses the image, versiona and inserts correctly into my HTML page, perfectly as I wanted and how it was set up.
However, when running tasks Grunt in index.html
that is in " public/firstapp
", where it points to CSS files with the path " ../css/---.css
", ../js/lib/---.js
"and an image with the path:" ../images/---.jpg
", instead of creating the css folder and js with the .bundle.min files and versioned within the" dist "folder configured in the grunt. It creates at a folder level at the top of the "test-versioning" root, and without versioning, only .bundle.min
, and in the result of index.html
, the call to the file gets " ../css/app.bundle.min.css
" and " ../js/app.bundle.min.js
", which do not exist. The image it compressed versiono and includes in the HTML correctly.
And also, when running tasks Grunt in index.html
that is in " public/secondapp
", where it points to CSS files with the path " /css/---.css
", the js " /js/lib/---.js
" and an image with the path: " /images/---.jpg
", it creates the dist
folder correctly, it creates the file " app.bundle.min.css
", but this file bundle
, comes empty, and versiona this file empty, but the call of the file in index.html
continues " /css/app.bundle.min.css
", without the versioning, and ends that of erro 404
since there is no such file. And even if I called the versioned, it would be blank. The same is true for js
and imagem
.