Browse Source

altera configurações para pasta público de tema ser importada no build

pull/2485/head
Leandro Roberto 7 years ago
parent
commit
09ed17ced8
  1. 9
      sapl-frontend/package.json
  2. 2
      sapl-frontend/src/apps/compilacao/main.js
  3. 3
      sapl-frontend/src/global/functions.js
  4. 8
      sapl-frontend/src/global/main.js
  5. 86
      sapl-frontend/vue.config.js
  6. 10
      sapl/settings.py

9
sapl-frontend/package.json

@ -34,10 +34,6 @@
"@vue/cli-service": "^3.3.0", "@vue/cli-service": "^3.3.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"css-loader": "^2.1.0", "css-loader": "^2.1.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.21",
"eslint": "^5.12.0", "eslint": "^5.12.0",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1", "eslint-friendly-formatter": "^4.0.1",
@ -46,6 +42,9 @@
"eslint-plugin-node": "^8.0.1", "eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1", "eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0", "eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.1.0" "eslint-plugin-vue": "^5.1.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.21"
} }
} }

2
sapl-frontend/src/apps/compilacao/main.js

@ -2,8 +2,6 @@
import './scss/compilacao.scss' import './scss/compilacao.scss'
import 'bootstrap'
import compilacao from './js/old/compilacao' import compilacao from './js/old/compilacao'
import compilacaoView from './js/old/compilacao_view' import compilacaoView from './js/old/compilacao_view'
import compilacaoNotas from './js/old/compilacao_notas' import compilacaoNotas from './js/old/compilacao_notas'

3
sapl-frontend/src/global/functions.js

@ -1,3 +1,6 @@
window.jQuery = jQuery
window.$ = jQuery
window.getCookie = function (name) { window.getCookie = function (name) {
var cookieValue = null var cookieValue = null
if (document.cookie && document.cookie !== '') { if (document.cookie && document.cookie !== '') {

8
sapl-frontend/src/global/main.js

@ -4,16 +4,14 @@ import 'jquery-mask-plugin'
import 'webpack-jquery-ui/dialog' import 'webpack-jquery-ui/dialog'
import 'webpack-jquery-ui/sortable' import 'webpack-jquery-ui/sortable'
import 'bootstrap'
import './functions' import './functions'
import 'bootstrap'
import './image_cropping' import './image_cropping'
require('imports-loader?window.jQuery=jquery!./jquery.runner.js') require('imports-loader?window.jQuery=jquery!./jquery.runner.js')
// require(THEME_CUSTOM + '/src/assets/img/authenticated.png')
window.jQuery = jQuery
window.$ = jQuery
window.autorModal() window.autorModal()
window.refreshMask() window.refreshMask()

86
sapl-frontend/vue.config.js

@ -8,22 +8,24 @@ dotenv.config({ path: '../sapl/.env' })
var THEME_CUSTOM = process.env.THEME_CUSTOM === undefined ? 'sapl-oficial-theme' : process.env.THEME_CUSTOM var THEME_CUSTOM = process.env.THEME_CUSTOM === undefined ? 'sapl-oficial-theme' : process.env.THEME_CUSTOM
module.exports = { module.exports = {
publicPath: 'http://localhost:8080/', publicPath: process.env.NODE_ENV === 'production' ? '/static/' : 'http://localhost:8080/',
outputDir: './dist/', outputDir: './dist/',
configureWebpack: {
devtool: 'cheap-module-eval-source-map',
},
chainWebpack: config => { chainWebpack: config => {
config.optimization config.optimization
.splitChunks(false) .splitChunks(false)
config config
.plugin('BundleTracker') .plugin('BundleTracker')
.use(BundleTracker, [{ filename: './webpack-stats.json' }]) .use(BundleTracker, [{ filename: './webpack-stats.json' }])
config.devtool = 'source-map'
config.resolve.alias config.resolve.alias
.set('__STATIC__', 'static') .set('__STATIC__', 'static')
config.devServer config.devServer
.public('') .public('')
.host('localhost') .host('localhost')
@ -36,11 +38,50 @@ module.exports = {
.contentBase([ .contentBase([
path.join(__dirname, 'public'), path.join(__dirname, 'public'),
path.join(__dirname, 'src', 'assets'), path.join(__dirname, 'src', 'assets'),
path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public') //path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public'),
//path.join(__dirname, 'node_modules', THEME_CUSTOM, 'src', 'assets')
]) ])
config
.plugin('copy')
.tap(([options]) => {
options.push(
{
from: path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public'),
to: path.join(__dirname, 'dist'),
toType: 'dir',
ignore: [
'.DS_Store'
]
})
return [options]
})
config.entryPoints.delete('app')
/*
new CopyWebpackPlugin(
[
{
from: '/home/leandro/desenvolvimento/envs/sapl/sapl-frontend/public',
to: '/home/leandro/desenvolvimento/envs/sapl/sapl-frontend/dist',
toType: 'dir',
ignore: [
'.DS_Store'
]
}
]
),
config
.module
.rule('images')
.use('url-loader')
.loader('url-loader')
.tap(options => {
options.fallback.options.name = (process.env.NODE_ENV === 'production'
? '/static/'
: '') + options.fallback.options.name
return options
}) */
config config
.plugin('provide') .plugin('provide')
.use(require('webpack/lib/ProvidePlugin'), [{ .use(require('webpack/lib/ProvidePlugin'), [{
@ -50,25 +91,28 @@ module.exports = {
jQuery: 'jquery', jQuery: 'jquery',
_: 'lodash' _: 'lodash'
}]) }])
config.entryPoints.delete('app')
config.entry(THEME_CUSTOM)
config
.entry(THEME_CUSTOM)
.add('./src/theme-dev/main.js') .add('./src/theme-dev/main.js')
// .add(THEME_CUSTOM + '/src/main.js') // .add(THEME_CUSTOM + '/src/main.js')
.end() .end()
config.entry('global') config
.entry('global')
.add('./src/global/main.js') .add('./src/global/main.js')
.end() .end()
config.entry('compilacao') config.entry('compilacao')
.add('./src/apps/compilacao/main.js') .add('./src/apps/compilacao/main.js')
.end() .end()
/* config /* config
.plugin('theme') .plugin('theme')
.use(webpack.DefinePlugin, [{ .use(webpack.DefinePlugin, [{
THEME_CUSTOM: JSON.stringify(THEME_CUSTOM) THEME_CUSTOM: JSON.stringify(THEME_CUSTOM)
}]) }])
.end() */ .end() */
} }
} }

10
sapl/settings.py

@ -264,32 +264,26 @@ LOCALE_PATHS = (
'locale', 'locale',
) )
WEBPACK_LOADER = { WEBPACK_LOADER = {
'DEFAULT': { 'DEFAULT': {
'CACHE': not DEBUG, 'CACHE': not DEBUG,
'BUNDLE_DIR_NAME': 'bundle/dist/', 'BUNDLE_DIR_NAME': 'dist/',
'STATS_FILE': FRONTEND_DIR.child('webpack-stats.json'), 'STATS_FILE': FRONTEND_DIR.child('webpack-stats.json'),
'POLL_INTERVAL': 0.1, 'POLL_INTERVAL': 0.1,
'TIMEOUT': None, 'TIMEOUT': None,
'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] 'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
} }
} }
THEME_CUSTOM = config('THEME_CUSTOM', default='sapl-oficial-theme') THEME_CUSTOM = config('THEME_CUSTOM', default='sapl-oficial-theme')
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR.child("collected_static") STATIC_ROOT = PROJECT_DIR.child("collected_static")
# STATICFILES_DIRS = (BASE_DIR.child("static"),)
STATICFILES_DIRS = ( STATICFILES_DIRS = (
# BASE_DIR.child("static"),
FRONTEND_DIR.child('dist'), FRONTEND_DIR.child('dist'),
) )
STATICFILES_FINDERS = ( STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',

Loading…
Cancel
Save