Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Geonode
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor statistics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
geo
Geonode
Commits
a077fc8d
Commit
a077fc8d
authored
11 years ago
by
Jeffrey Johnson
Browse files
Options
Downloads
Plain Diff
Merge pull request #1104 from cspanring/fix-grunt-replace
fixes regex in replace grunt task
parents
6600ed0e
e725bc81
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geonode/static/gruntfile.js
+25
-10
25 additions, 10 deletions
geonode/static/gruntfile.js
geonode/static/lib/css/assets.min.css
+1
-1
1 addition, 1 deletion
geonode/static/lib/css/assets.min.css
with
26 additions
and
11 deletions
geonode/static/gruntfile.js
+
25
−
10
View file @
a077fc8d
...
...
@@ -121,23 +121,38 @@ module.exports = function(grunt) {
}
},
// replace image paths in CSS to match lib/img/
/*!
* change image paths in CSS to match url('../lib/img/image.png')
* regex should cover following url patterns:
* /url\("?images\//g url("images/animated-overlay.gif")
* url(images/ui-bg_flat_75_ffffff_40x100.png)
* /url\('(?!(images|\.))/g url('select2.png')
* url('spinner.gif')
* /url\((?!('|"))/g url(select2x2.png)
* must not change url('../img/switch.png')
* /url\('\.\.\/images\//g url('../images/back_enabled.png')
* must not change alpha(opacity=25)
*
* TODO: write testcase
* var urls = ['url("images/animated-overlay.gif")', 'url(images/ui-bg_flat_75_ffffff_40x100.png)', "url('select2.png')", "url('spinner.gif')", "url(select2x2.png)", "url('../img/switch.png')", "url('../images/back_enabled.png')", "alpha(opacity=25)"],
* urlsClean = [];
* urls.forEach(function(elem) {
* var urlClean = elem.replace(/url\((("?images\/)|('(?!(images|\.)))|(?!('|"))|('\.\.\/images\/))/g, 'url(\'../img/').replace(/(png|gif|jpg)?(\)|'\)|"\))/g, '$1\')');
* urlsClean.push(urlClean);
* });
* console.log(urlsClean);
*/
replace
:
{
development
:
{
src
:
[
'
lib/css/*.css
'
],
overwrite
:
true
,
replacements
:
[{
from
:
/url
\(
'
(?!\.
)
/g
,
from
:
/url
\(
((
"
?
images
\/)
|
(
'
(?!(
images|
\.)))
|
(?!(
'|"
))
|
(
'
\.\.\/
images
\/)
)
/g
,
to
:
'
url(
\'
../img/
'
},
{
from
:
/url
\((?!\')
/g
,
to
:
'
url(
\'
../img/
'
},
{
from
:
/..
\/
images
\/
/g
,
to
:
'
../img/
'
},
{
from
:
/
(
png|gif|jpg
)(?=\))
/g
,
to
:
'
$1
\'
'
from
:
/
(
png|gif|jpg
)
+
(\)
|'
\)
|"
\))
/g
,
to
:
'
$1
\'
)
'
}]
}
},
...
...
This diff is collapsed.
Click to expand it.
geonode/static/lib/css/assets.min.css
+
1
−
1
View file @
a077fc8d
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment