Problems with Grunt tasks for versioning when html files are inside other folders

Asked

Viewed 125 times

3

Using Grunt, I installed and configured the 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 at the root of the public, a index.html in a briefcase firstapp within the public and another index.html inside the "secondapp" folder also inside the public.

My image folder is at the root of public "public/images" my CSS files are in public/css, and the archives js are in public/js/lib.

When rotating the tasks of Grunt, the index.html which is at the root, where it points to the css files with the simple path: "css/---.css", the files js with the paths "js/lib/---.js" and an image with the path "images/---.jpg". is properly configured, it creates the file "raiz.bundle.min.css" inside the briefcase css, versiona and insert it into the Htmlpage correctly, creates the file "raiz.bundle.min.js" inside the briefcase js, versiona and also inserts it into the HTML page correctly, compresses the image, versiona and inserts it correctly into my HTML page, perfectly as I wanted and as it was configured.

However, when turning the tasks Grunt na index.html which is in "public/firstapp", where it points to the CSS files with the path "../css/---.css", the js files "../js/lib/---.js" and an image with the path: "../images/---.jpg", instead of creating the css and js folder with the .bundle.min and versioned files inside the "dist" folder configured in Grunt. It creates on a folder level at the top, at the root of the "test-versioning", and without versioning, only .bundle.min, and the outcome of index.html, the call to the archive "../css/app.bundle.min.css" and "../js/app.bundle.min.js", which do not exist. The image it compressed versiono and includes in HTML correctly.

Also, when turning the tasks Grunt na index.html which is in "public/secondapp", where it points to the CSS files with the path "/css/---.css", the js files "/js/lib/---.js" and an image with the path: "/images/---.jpg", it creates the folder dist correctly, creates the file "app.bundle.min.css", but this file bundle, comes empty, and versionates this empty file, however the file call on index.html continues "/css/app.bundle.min.css", without the versioning, and it turns out that erro 404 because this file does not exist. And even if called the versioned, it would be blank. The same occurs for the js and to the imagem.

https://github.com/aldo-jr/teste-versionamento

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.