Skip to content

Commit

Permalink
(#468) use npm packages to replace bower dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBarranqueiro committed Mar 19, 2018
1 parent bf84949 commit 6f64f58
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 73 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules/
source/_bower_components/
source/assets/
source/_js/smartresize.js
source/_js/smartresize.js
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.sass-cache
assets
node_modules
_bower_components
21 changes: 0 additions & 21 deletions bower.json

This file was deleted.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "A gorgeous responsive theme for Hexo blog framework",
"main": "Gruntfile.js",
"scripts": {
"postinstall": "./node_modules/bower/bin/bower install",
"start": "npm run grunt -- default",
"build": "npm run prod",
"prod": "npm run grunt -- buildProd",
Expand All @@ -30,14 +29,13 @@
},
"homepage": "https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak",
"devDependencies": {
"bower": "1.8.2",
"eslint": "4.18.2",
"eslint-config-google": "0.9.1",
"grunt": "1.0.2",
"grunt-bower": "0.21.4",
"grunt-cli": "1.2.0",
"grunt-contrib-clean": "1.1.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "2.2.1",
"grunt-contrib-uglify": "3.3.0",
"grunt-contrib-watch": "1.0.0",
Expand All @@ -51,7 +49,10 @@
"rand-token": "0.4.0"
},
"dependencies": {
"@fancyapps/fancybox": "3.2.5",
"font-awesome": "4.7.0",
"hexo-util": "0.6.3",
"jquery": "3.3.1",
"jsdom": "11.6.2",
"strip-indent": "2.0.0"
},
Expand Down
41 changes: 0 additions & 41 deletions tasks/config/bower.js

This file was deleted.

64 changes: 64 additions & 0 deletions tasks/config/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var jsDestFolder = './source/assets/js/';
var cssDestFolder = './source/assets/css/';
var fontsDestFolder = './source/assets/fonts/';

var fancyboxPath = './node_modules/@fancyapps/fancybox';
var fontAwesomePath = './node_modules/font-awesome';
var jqueryPath = './node_modules/jquery';

module.exports = function(grunt) {
grunt.config.set('copy', {
// Copy all needed files by types
dev: {
files: [
// fancybox
{
src: fancyboxPath + '/dist/jquery.fancybox.css',
dest: cssDestFolder,
flatten: true,
expand: true
},
{
src: fancyboxPath + '/dist/jquery.fancybox.js',
dest: jsDestFolder,
flatten: true,
expand: true
},
{
src: fancyboxPath + '/src/js/thumbs.js',
dest: jsDestFolder,
flatten: true,
expand: true
},
{
src: fancyboxPath + '/src/css/thumbs.css',
dest: cssDestFolder,
flatten: true,
expand: true
},
// font-awesome
{
src: fontAwesomePath + '/css/font-awesome.css',
dest: cssDestFolder,
flatten: true,
expand: true
},
{
src: fontAwesomePath + '/fonts/*',
dest: fontsDestFolder,
flatten: true,
expand: true
},
// jquery
{
src: jqueryPath + '/dist/jquery.js',
dest: jsDestFolder,
flatten: true,
expand: true
}
]
}
});

grunt.loadNpmTasks('grunt-contrib-copy');
};
2 changes: 1 addition & 1 deletion tasks/register/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = function(grunt) {
// Build (environment : development)
grunt.registerTask('build', [
'clean:build',
'bower:dev',
'copy:dev',
'syncAssets',
'linkAssets',
'replace:cssFancybox',
Expand Down
2 changes: 1 addition & 1 deletion tasks/register/buildProd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = function(grunt) {
// Build (environment : production)
grunt.registerTask('buildProd', [
'clean:build',
'bower:dev',
'copy:dev',
'syncAssets',
'replace:cssFancybox',
'replace:cssTranquilpeak',
Expand Down

0 comments on commit 6f64f58

Please sign in to comment.