Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
015ee2ed
Commit
015ee2ed
authored
Aug 28, 2014
by
James Friend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pulled output path out to gruntfile
parent
9aeaf19b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
Gruntfile.js
Gruntfile.js
+4
-3
grunt/bs-commonjs-generator.js
grunt/bs-commonjs-generator.js
+8
-9
No files found.
Gruntfile.js
View file @
015ee2ed
...
...
@@ -438,7 +438,7 @@ module.exports = function (grunt) {
grunt
.
registerTask
(
'
test
'
,
testSubtasks
);
// JS distribution task.
grunt
.
registerTask
(
'
dist-js
'
,
[
'
concat
'
,
'
uglify:core
'
]);
grunt
.
registerTask
(
'
dist-js
'
,
[
'
concat
'
,
'
uglify:core
'
,
'
commonjs
'
]);
// CSS distribution task.
grunt
.
registerTask
(
'
less-compile
'
,
[
'
less:compileCore
'
,
'
less:compileTheme
'
]);
...
...
@@ -464,8 +464,9 @@ module.exports = function (grunt) {
});
grunt
.
registerTask
(
'
commonjs
'
,
'
Generate CommonJS entrypoint module in dist dir.
'
,
function
()
{
var
files
=
grunt
.
config
.
get
(
'
concat.bootstrap.src
'
);
generateCommonJSModule
(
grunt
,
files
);
var
srcFiles
=
grunt
.
config
.
get
(
'
concat.bootstrap.src
'
);
var
destFilepath
=
'
dist/js/npm.js
'
;
generateCommonJSModule
(
grunt
,
srcFiles
,
destFilepath
);
});
// Docs task.
...
...
grunt/bs-commonjs-generator.js
View file @
015ee2ed
...
...
@@ -2,17 +2,16 @@
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
var
destDir
=
'
dist/js
'
;
var
destFilename
=
'
npm.js
'
;
var
destFilepath
=
path
.
join
(
destDir
,
destFilename
);
module
.
exports
=
function
generateCommonJSModule
(
grunt
,
srcFiles
,
destFilepath
)
{
var
destDir
=
path
.
dirname
(
destFilepath
);
function
srcPathToDestRequire
(
srcFilepath
)
{
function
srcPathToDestRequire
(
srcFilepath
)
{
var
requirePath
=
path
.
relative
(
destDir
,
srcFilepath
);
return
"
require('
"
+
requirePath
+
"
')
"
;
}
}
var
moduleOutputJs
=
srcFiles
.
map
(
srcPathToDestRequire
).
join
(
'
\n
'
);
module
.
exports
=
function
generateCommonJSModule
(
grunt
,
files
)
{
var
moduleOutputJs
=
files
.
map
(
srcPathToDestRequire
).
join
(
'
\n
'
);
try
{
fs
.
writeFileSync
(
destFilepath
,
moduleOutputJs
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment