Comments (7)
Yeah that should exactly as you want it, see https://github.com/pgilad/grunt-jade-usemin/blob/master/test/test.js#L44-L55
Basically the configuration you need to have in your Gruntfile.js
:
jadeUsemin: {
build: {
options: {
tasks: {
tasks: {
js: ['concat', 'uglify', 'filerev'],
css: ['concat', 'cssmin']
}
},
dirTasks: ['filerev'],
prefix:'public/' //public is a mount in express
},
files: [{
dest: './build/views/layout.jade',
src: './build/views/layout.jade'
}]
}
}
Try that out and let me know how it works (it's a new feature introduced in 0.5.0)
from grunt-jade-usemin.
Yeah, so in that case I start getting these errors:
Running "concat:jadeUsemin-js" (concat) task
Warning: Unable to create directory "/javascripts" (Error code: EACCES). Use --force to continue.
Which is because of how the targets are setup in layout.jade
, they don't know about /public
nor about ./build/public
.
from grunt-jade-usemin.
This looks like a problem with the prefix
option. I'm going to test it out, in the meantime - can you try inlining the public
prefix into the scripts to see if it works? (and don't forget to remove it as an option)
Edit
Actually I tested the prefix
option, and it works. The problem is that the prefix
isn't added to the targetPath of the script (this is in the works for a PR, see #11)
So in the target path of your script, you'll need to write the full output path, i.e:
src='build/public/javascripts/lib/jquery.min.js'
from grunt-jade-usemin.
Right. Yeah, I was just getting to this now, and I see that's the case. It works as expected if I setup my build block like so:
//-<!-- build:js build/public/javascripts/lib/jquery.min.js -->
script(src='/javascripts/lib/jquery.js')
//-<!-- endbuild -->
Which gets me this in the output:
script(src='build/public/javascripts/lib/jquery.min.f6094334.js')
Which is good, progress, but that URI is definitely bogus in the app. It needs to be without build/public
, and it looks like what you're saying is that with targetPrefix
in #11, I might get where I need to be?
from grunt-jade-usemin.
I added the targetPrefix
option to be used exactly as prefix
but for target scripts. Can you try using it (with version 0.5.2) and see if it's working for you?
from grunt-jade-usemin.
Looks good! Thanks, Gilad...
from grunt-jade-usemin.
from grunt-jade-usemin.
Related Issues (20)
- Feature request: Incorporate file revision hash HOT 5
- Create examples.md which shows various usages examples
- Plugin fails when minblock has no tags
- Add option to specify destination directory for taks HOT 12
- It's not clear how to add config for tasks HOT 3
- filerev task doesn't work when using the same output file per two pages HOT 3
- filerev task doesn't work when using the same output file per two pages with targetPrefix HOT 1
- Unable to use absolute path to compiled source HOT 12
- Included assets don't bundled? HOT 7
- How to override source js/css files with revved ones? HOT 6
- Source Maps HOT 2
- Warning: Task "concat:jadeUsemin-css" not found. HOT 15
- Should we fail when script src does not exist? HOT 2
- Pug files are not processed HOT 2
- possibly wrong warning on css&js build types HOT 3
- Task "concat:jadeUsemin" not found HOT 2
- Feature request - write target jade files after replacing build blocks
- Image path in css is not being replaced with relative or absolute path HOT 9
- location is not defined HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-jade-usemin.