Comments (7)
This is kind of a duplicate of: #46
This is kind of outside the scope of History.js - the files are compressed with Buildr + UglifyJS which omits the end-of-file semi-colon in the compressed versions of the file. Buildr also supports bundling too, you can change the "buildr" part in the package.json
file to:
"buildr": {
"compress": {
"js": true,
"css": false,
"img": false,
"html": false
},
"check": {
"js": true,
"jsOptions": {
"browser": true,
"laxbreak": true,
"boss": true,
"undef": true,
"onevar": true,
"strict": true
}
},
"ignore": {
"check": [
"json2.js",
"amplify.store.js"
]
},
"bundle": {
"js": "history.all.js",
"css": false
},
"directories": {
"out": "./scripts/compressed",
"src": "./scripts/uncompressed"
},
"files": {
"js": [
"amplify.store.js",
"history.adapter.jquery.js",
"history.js"
],
"css": false,
"img": false
}
}
and that will bundle the mentioned js files into a history.all.js
file. Or I'd say that in your bundling script, it should be adding semicolons between files.
Though with closure and uglify I've never had an issue bundling. Here is also a php script that I've used to bundle with closure: https://github.com/balupton/balphp/blob/master/lib/Bal/View/Helper/HeadScriptBundler.php#L77
from history.js.
Related UglifyJS Issue: mishoo/UglifyJS#126 (comment)
Because I am including history js as a git submodule and inlining the minified files, I had to do this in my HAML:
%script
-# inlining minified libraries
-# having to insert a few missing semicolons.
= render :file => 'public/javascripts/lib/history/scripts/compressed/history.adapter.zepto.js'
\;
= render :file => 'public/javascripts/lib/history/scripts/compressed/history.js'
\;
= render :file => 'public/javascripts/lib/history/scripts/compressed/history.html4.js'
\;
Google Closure preserves the trailing semicolon for this reason. I am not sure what other minification libraries do.
It would be nice if the minified files were immediately usable, otherwise, why provide them at all?
from history.js.
I've got a question. Does the bundler you're using also minify? If so, just include the uncompressed scripts...
It would be nice if the minified files were immediately usable, otherwise, why provide them at all?
They are individually, which is actually what the majority of people do :/
from history.js.
I have a rake script that watches my javascript files for changes, runs it through yui's compressor, and then outputs a minified file in a different directory. I could update it to consider the uncompressed history.js javascript, but then I lose the benefit of having a git submodule to manage the library.
from history.js.
... how would it affect git submodules? Both the uncompressed and compressed are in the same git repo...
from history.js.
Yup, still causing pain.
from history.js.
Yes, still causing pain in 2017...
from history.js.
Related Issues (20)
- Few test cases are failing on X86. Saying "operation insecure"
- How to use History API State with hash urls?
- IE/Edge pop last saved object irrespective of current URL
- change url cross domain
- native.history.js detected as virus HOT 1
- No default jsDelivr CDN file set
- jquery.history.js breaks the script adn return "History.js Adapter has already been loaded..." error.
- replaceState removes first character of hash (#) when it contains dot "."
- indicating locale code to url
- Problems with webpack encore at page loading
- The Solutions section is missing the hashtag solution
- Change domain "mysite.com/page1" to "mysite.com"
- npm WARN deprecated: Update deprecated dependencies HOT 1
- history.goback() is not working for mozilla firefox
- page is not jump used push HOT 1
- OnPopState calls in case of section change
- Back Button Error while using with VueJs Data
- Revise tests
- How to unbind function from History.Adapter.bind? HOT 1
- security scan result HOT 2
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 history.js.